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 obj->phdr must be the absolute address, no...
details: https://anonhg.NetBSD.org/src/rev/360ae030aea2
branches: trunk
changeset: 345371:360ae030aea2
user: joerg <joerg%NetBSD.org@localhost>
date: Sun May 22 19:28:39 2016 +0000
description:
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:
libexec/ld.elf_so/headers.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diffs (30 lines):
diff -r 6dafae49140c -r 360ae030aea2 libexec/ld.elf_so/headers.c
--- a/libexec/ld.elf_so/headers.c Sun May 22 19:26:04 2016 +0000
+++ b/libexec/ld.elf_so/headers.c Sun May 22 19:28:39 2016 +0000
@@ -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 @@
if (ph->p_type != PT_PHDR)
continue;
- obj->phdr = (void *)(uintptr_t)ph->p_vaddr;
+ 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;
- obj->relocbase = (caddr_t)((uintptr_t)phdr - (uintptr_t)ph->p_vaddr);
dbg(("headers: phdr %p (%p) phsize %zu relocbase %p",
obj->phdr, phdr, obj->phsize, obj->relocbase));
break;
Home |
Main Index |
Thread Index |
Old Index