aboutsummaryrefslogtreecommitdiff
path: root/libexec/rtld-elf/powerpc64/rtld_machdep.h
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2012-03-11 20:03:09 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2012-03-11 20:03:09 +0000
commit83aa9cc00c2d83d05a0efe7a1496d8aab4a153bb (patch)
treee4eae50ab265adfbfc5e1f5293bdb637284ed4f5 /libexec/rtld-elf/powerpc64/rtld_machdep.h
parentd1545c15cf0586b4040f3195cf9ab446c2ff2110 (diff)
downloadsrc-83aa9cc00c2d83d05a0efe7a1496d8aab4a153bb.tar.gz
src-83aa9cc00c2d83d05a0efe7a1496d8aab4a153bb.zip
Add support for preinit, init and fini arrays. Some ABIs, in
particular on ARM, do require working init arrays. Traditional FreeBSD crt1 calls _init and _fini of the binary, instead of allowing runtime linker to arrange the calls. This was probably done to have the same crt code serve both statically and dynamically linked binaries. Since ABI mandates that first is called preinit array functions, then init, and then init array functions, the init have to be called from rtld now. To provide binary compatibility to old FreeBSD crt1, which calls _init itself, rtld only calls intializers and finalizers for main binary if binary has a note indicating that new crt was used for linking. Add parsing of ELF notes to rtld, and cache p_osrel value since we parsed it anyway. The patch is inspired by init_array support for DragonflyBSD, written by John Marino. Reviewed by: kan Tested by: andrew (arm, previous version), flo (sparc64, previous version) MFC after: 3 weeks
Notes
Notes: svn path=/head/; revision=232831
Diffstat (limited to 'libexec/rtld-elf/powerpc64/rtld_machdep.h')
-rw-r--r--libexec/rtld-elf/powerpc64/rtld_machdep.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/libexec/rtld-elf/powerpc64/rtld_machdep.h b/libexec/rtld-elf/powerpc64/rtld_machdep.h
index 041efe09937f..b88ed9deef47 100644
--- a/libexec/rtld-elf/powerpc64/rtld_machdep.h
+++ b/libexec/rtld-elf/powerpc64/rtld_machdep.h
@@ -48,6 +48,9 @@ Elf_Addr reloc_jmpslot(Elf_Addr *where, Elf_Addr target,
#define call_initfini_pointer(obj, target) \
(((InitFunc)(target))())
+#define call_init_pointer(obj, target) \
+ (((InitArrFunc)(target))(main_argc, main_argv, environ))
+
/*
* Lazy binding entry point, called via PLT.
*/