summaryrefslogtreecommitdiffstats
path: root/libexec
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2014-07-02 22:04:12 +0000
committermarcel <marcel@FreeBSD.org>2014-07-02 22:04:12 +0000
commit365201465e13eb330b92bd6e6aca3aaf0cf6c15e (patch)
treebff2414c3f5e0bd53e6a15f04713816820821fdd /libexec
parent4618d6ea2b194495e611c1e2ccebc58e7bcd616d (diff)
downloadFreeBSD-src-365201465e13eb330b92bd6e6aca3aaf0cf6c15e.zip
FreeBSD-src-365201465e13eb330b92bd6e6aca3aaf0cf6c15e.tar.gz
Fix r264346 for ia64. We need to allocate memory for the function
descriptors in order to relocate RTLD itself. To allocate memory, we need the pagesizes array initialized, but that happens after RTLD is relocated. This ordering is important for amd64, but it's opposite of what ia64 needs. Handle this conflict with the define called RTLD_INIT_PAGESIZES_EARLY. When defined, obtain the page sizes before relocating rtld, otherwise do it after.
Diffstat (limited to 'libexec')
-rw-r--r--libexec/rtld-elf/ia64/rtld_machdep.h2
-rw-r--r--libexec/rtld-elf/rtld.c7
2 files changed, 9 insertions, 0 deletions
diff --git a/libexec/rtld-elf/ia64/rtld_machdep.h b/libexec/rtld-elf/ia64/rtld_machdep.h
index 4a68ff7..b00a90fc 100644
--- a/libexec/rtld-elf/ia64/rtld_machdep.h
+++ b/libexec/rtld-elf/ia64/rtld_machdep.h
@@ -69,4 +69,6 @@ extern void *__tls_get_addr(unsigned long module, unsigned long offset);
#define RTLD_DEFAULT_STACK_PF_EXEC 0
#define RTLD_DEFAULT_STACK_EXEC 0
+#define RTLD_INIT_PAGESIZES_EARLY 1
+
#endif
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index ed313e1..0c53a16 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -1802,6 +1802,11 @@ init_rtld(caddr_t mapbase, Elf_Auxinfo **aux_info)
const Elf_Dyn *dyn_soname;
const Elf_Dyn *dyn_runpath;
+#ifdef RTLD_INIT_PAGESIZES_EARLY
+ /* The page size is required by the dynamic memory allocator. */
+ init_pagesizes(aux_info);
+#endif
+
/*
* Conjure up an Obj_Entry structure for the dynamic linker.
*
@@ -1838,8 +1843,10 @@ init_rtld(caddr_t mapbase, Elf_Auxinfo **aux_info)
/* Now that non-local variables can be accesses, copy out obj_rtld. */
memcpy(&obj_rtld, &objtmp, sizeof(obj_rtld));
+#ifndef RTLD_INIT_PAGESIZES_EARLY
/* The page size is required by the dynamic memory allocator. */
init_pagesizes(aux_info);
+#endif
if (aux_info[AT_OSRELDATE] != NULL)
osreldate = aux_info[AT_OSRELDATE]->a_un.a_val;
OpenPOWER on IntegriCloud