Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/libexec/ld.elf_so Revert previous for now. It's part of a la...
details: https://anonhg.NetBSD.org/src/rev/f96a1fbe4e1a
branches: trunk
changeset: 758045:f96a1fbe4e1a
user: skrll <skrll%NetBSD.org@localhost>
date: Fri Oct 15 15:08:05 2010 +0000
description:
Revert previous for now. It's part of a larger commit which will arrive
soon.
diffstat:
libexec/ld.elf_so/headers.c | 30 ++++++++++++------------------
1 files changed, 12 insertions(+), 18 deletions(-)
diffs (62 lines):
diff -r d18394969a88 -r f96a1fbe4e1a libexec/ld.elf_so/headers.c
--- a/libexec/ld.elf_so/headers.c Fri Oct 15 12:29:17 2010 +0000
+++ b/libexec/ld.elf_so/headers.c Fri Oct 15 15:08:05 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: headers.c,v 1.34 2010/10/15 07:22:44 skrll Exp $ */
+/* $NetBSD: headers.c,v 1.35 2010/10/15 15:08:05 skrll Exp $ */
/*
* Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: headers.c,v 1.34 2010/10/15 07:22:44 skrll Exp $");
+__RCSID("$NetBSD: headers.c,v 1.35 2010/10/15 15:08:05 skrll Exp $");
#endif /* not lint */
#include <err.h>
@@ -307,26 +307,19 @@
const Elf_Phdr *phlimit = phdr + phnum;
const Elf_Phdr *ph;
int nsegs = 0;
+ ptrdiff_t relocoffs = 0;
Elf_Addr vaddr;
obj = _rtld_obj_new();
+ for (ph = phdr; ph < phlimit; ++ph) {
+ vaddr = ph->p_vaddr + relocoffs;
+ switch (ph->p_type) {
- for (ph = phdr; ph < phlimit; ++ph) {
- if (ph->p_type != PT_PHDR)
- continue;
-
- obj->phdr = (void *)(uintptr_t)phdr->p_vaddr;
- obj->phsize = phdr->p_memsz;
- obj->relocbase = (caddr_t)((uintptr_t)phdr - (uintptr_t)ph->p_vaddr);
- dbg(("headers: phdr %p phsize %zu relocbase %lx", obj->phdr,
- obj->phsize, (long)obj->relocbase));
- break;
- }
- assert(obj->phdr == phdr);
-
- for (ph = phdr; ph < phlimit; ++ph) {
- vaddr = (Elf_Addr)obj->relocbase + ph->p_vaddr;
- switch (ph->p_type) {
+ case PT_PHDR:
+ relocoffs = (uintptr_t)phdr - (uintptr_t)ph->p_vaddr;
+ dbg(("headers: phdr %p phsize %zu relocoffs %lx", obj->phdr,
+ obj->phsize, (long)relocoffs));
+ break;
case PT_INTERP:
obj->interp = (const char *)(uintptr_t)vaddr;
@@ -337,6 +330,7 @@
if (nsegs == 0) { /* First load segment */
obj->vaddrbase = round_down(vaddr);
obj->mapbase = (caddr_t)(uintptr_t)obj->vaddrbase;
+ obj->relocbase = (void *)relocoffs;
obj->textsize = round_up(vaddr + ph->p_memsz) -
obj->vaddrbase;
} else { /* Last load segment */
Home |
Main Index |
Thread Index |
Old Index