/freebsd/libexec/rtld-elf/ |
H A D | map_object.c | diff 83aa9cc00c2d83d05a0efe7a1496d8aab4a153bb Sun Mar 11 21:03:09 CET 2012 Konstantin Belousov <kib@FreeBSD.org> 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
|
H A D | Makefile | diff 83aa9cc00c2d83d05a0efe7a1496d8aab4a153bb Sun Mar 11 21:03:09 CET 2012 Konstantin Belousov <kib@FreeBSD.org> 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
|
H A D | rtld.h | diff 83aa9cc00c2d83d05a0efe7a1496d8aab4a153bb Sun Mar 11 21:03:09 CET 2012 Konstantin Belousov <kib@FreeBSD.org> 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
|
H A D | rtld.c | diff 83aa9cc00c2d83d05a0efe7a1496d8aab4a153bb Sun Mar 11 21:03:09 CET 2012 Konstantin Belousov <kib@FreeBSD.org> 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
|