]> git.wh0rd.org Git - elf2flt.git/commitdiff
This patch adds support for .preinit_array, .init_array and .fini_array
authorDavid McCullough <davidm@snapgear.com>
Thu, 23 Mar 2006 23:06:49 +0000 (23:06 +0000)
committerDavid McCullough <davidm@snapgear.com>
Thu, 23 Mar 2006 23:06:49 +0000 (23:06 +0000)
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 <richard@codesourcery.com>
elf2flt.ld

index e0f3f2b9820668363f9483449ddbf36c016d547e..3a8cf157114d3161062ba8ba3b0b8e0999887d6c 100644 (file)
@@ -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