diff options
| author | joerg <joerg@NetBSD.org> | 2016-05-22 19:28:39 +0000 |
|---|---|---|
| committer | joerg <joerg@NetBSD.org> | 2016-05-22 19:28:39 +0000 |
| commit | 32438d0c272fa4deb3dc479a272b05cd3cb96bef (patch) | |
| tree | ca29c090c2bfcada42e4cddde8e66b6dc1d97bf2 /libexec | |
| parent | 8015811096018e25ccb1fad4e21e4b3d82989007 (diff) | |
obj->phdr must be the absolute address, not the virtual offset from the
main binary. Historically, this has been the same. For PIE though,
relocbase can be pretty much anywhere. Fixes PR toolchain/51159.
Diffstat (limited to 'libexec')
| -rw-r--r-- | libexec/ld.elf_so/headers.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libexec/ld.elf_so/headers.c b/libexec/ld.elf_so/headers.c index cd4e4c59637..a2945ec70d0 100644 --- a/libexec/ld.elf_so/headers.c +++ b/libexec/ld.elf_so/headers.c @@ -1,4 +1,4 @@ -/* $NetBSD: headers.c,v 1.59 2014/08/26 21:20:05 joerg Exp $ */ +/* $NetBSD: headers.c,v 1.60 2016/05/22 19:28:39 joerg Exp $ */ /* * Copyright 1996 John D. Polstra. @@ -40,7 +40,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: headers.c,v 1.59 2014/08/26 21:20:05 joerg Exp $"); +__RCSID("$NetBSD: headers.c,v 1.60 2016/05/22 19:28:39 joerg Exp $"); #endif /* not lint */ #include <err.h> @@ -389,9 +389,9 @@ _rtld_digest_phdr(const Elf_Phdr *phdr, int phnum, caddr_t entry) if (ph->p_type != PT_PHDR) continue; - obj->phdr = (void *)(uintptr_t)ph->p_vaddr; - obj->phsize = ph->p_memsz; obj->relocbase = (caddr_t)((uintptr_t)phdr - (uintptr_t)ph->p_vaddr); + obj->phdr = phdr; /* Equivalent to relocbase + p_vaddr. */ + obj->phsize = ph->p_memsz; dbg(("headers: phdr %p (%p) phsize %zu relocbase %p", obj->phdr, phdr, obj->phsize, obj->relocbase)); break; |
