Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-8]: src/libexec/ld.elf_so Pull up following revision(s) (requeste...
details: https://anonhg.NetBSD.org/src/rev/49941cfe8915
branches: netbsd-8
changeset: 434040:49941cfe8915
user: snj <snj%NetBSD.org@localhost>
date: Fri Jun 30 06:28:54 2017 +0000
description:
Pull up following revision(s) (requested by joerg in ticket #63):
libexec/ld.elf_so/headers.c: revision 1.62
Remove old assert that only two segments exist. The rest of the code has
been changed to cope with more and at least Go actively creates them.
Adjust the mapping size computation to use the maximum and not depend on
PT_LOAD segments to be in order.
diffstat:
libexec/ld.elf_so/headers.c | 23 +++++++++++------------
1 files changed, 11 insertions(+), 12 deletions(-)
diffs (62 lines):
diff -r b627c3a225eb -r 49941cfe8915 libexec/ld.elf_so/headers.c
--- a/libexec/ld.elf_so/headers.c Fri Jun 30 06:27:38 2017 +0000
+++ b/libexec/ld.elf_so/headers.c Fri Jun 30 06:28:54 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: headers.c,v 1.61 2016/06/14 13:06:41 christos Exp $ */
+/* $NetBSD: headers.c,v 1.61.8.1 2017/06/30 06:28:54 snj Exp $ */
/*
* Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: headers.c,v 1.61 2016/06/14 13:06:41 christos Exp $");
+__RCSID("$NetBSD: headers.c,v 1.61.8.1 2017/06/30 06:28:54 snj Exp $");
#endif /* not lint */
#include <err.h>
@@ -380,8 +380,9 @@
Obj_Entry *obj;
const Elf_Phdr *phlimit = phdr + phnum;
const Elf_Phdr *ph;
- int nsegs = 0;
- Elf_Addr vaddr;
+ bool first_seg = true;
+ Elf_Addr vaddr;
+ size_t size;
obj = _rtld_obj_new();
@@ -409,17 +410,16 @@
break;
case PT_LOAD:
- assert(nsegs < 2);
- if (nsegs == 0) { /* First load segment */
+ size = round_up(vaddr + ph->p_memsz) - obj->vaddrbase;
+ if (first_seg) { /* First load segment */
obj->vaddrbase = round_down(vaddr);
obj->mapbase = (caddr_t)(uintptr_t)obj->vaddrbase;
- obj->textsize = round_up(vaddr + ph->p_memsz) -
- obj->vaddrbase;
+ obj->textsize = size;
+ obj->mapsize = size;
+ first_seg = false;
} else { /* Last load segment */
- obj->mapsize = round_up(vaddr + ph->p_memsz) -
- obj->vaddrbase;
+ obj->mapsize = MAX(obj->mapsize, size);
}
- ++nsegs;
dbg(("headers: %s %p phsize %" PRImemsz,
"PT_LOAD", (void *)(uintptr_t)vaddr,
ph->p_memsz));
@@ -466,7 +466,6 @@
#endif
}
}
- assert(nsegs == 2);
obj->entry = entry;
return obj;
Home |
Main Index |
Thread Index |
Old Index