From: David McCullough Date: Thu, 23 Mar 2006 23:06:49 +0000 (+0000) Subject: This patch adds support for .preinit_array, .init_array and .fini_array X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=bfb08d44f34f9dda67b303fd68f1441bc0edc85e;p=elf2flt.git This patch adds support for .preinit_array, .init_array and .fini_array to the elf2flt linker script. This seems useful in itself, and is actually required for recent versions of uclibc, where UCLIBC_CTOR_DTOR=y depends on the associated array symbols being defined. Tested on m68k-uclinux using the gcc and g++ DejaGNU testsuites. I also ran some tests by hand to make sure that callbacks in the array sections were being called at the right time. Please install if OK. Richard Signed-off-by: Richard Sandiford --- diff --git a/elf2flt.ld b/elf2flt.ld index e0f3f2b..3a8cf15 100644 --- a/elf2flt.ld +++ b/elf2flt.ld @@ -99,6 +99,20 @@ R_RODAT *(.rodata.*) LONG(0) __DTOR_END__ = .; + PROVIDE (__preinit_array_start = .); + KEEP (*(.preinit_array)) + PROVIDE (__preinit_array_end = .); + + PROVIDE (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE (__init_array_end = .); + + PROVIDE (__fini_array_start = .); + KEEP (*(.fini_array)) + KEEP (*(SORT(.fini_array.*))) + PROVIDE (__fini_array_end = .); + . = ALIGN(0x10) ; _edata = . ; } > flatmem