[patch] Keeep init_array sections
Paul Brook
paul@codesourcery.com
Thu Sep 23 19:54:00 GMT 2004
The following patch prevents ld from discarding the contents
of .preinit_array, .init_array and .fini_array. These are similar to
the .ctors and .dtors sections.
Tested with cross to arm-none-eabi, and built --targets=all.
Ok?
Paul
2004-09-23 Paul Brook <paul@codeosurcery.com>
* scripttempl/elf.sc: Keep .preinit_array, .init_array and
.fini_array sections.
Index: scripttempl/elf.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/elf.sc,v
retrieving revision 1.46
diff -u -p -r1.46 elf.sc
--- scripttempl/elf.sc 5 Jul 2004 20:00:13 -0000 1.46
+++ scripttempl/elf.sc 23 Sep 2004 19:28:52 -0000
@@ -335,15 +335,15 @@ cat <<EOF
be empty, which isn't pretty. */
${RELOCATING+. = ALIGN(${ALIGNMENT});}
${RELOCATING+${CREATE_SHLIB-PROVIDE (__preinit_array_start = .);}}
- .preinit_array ${RELOCATING-0} : { *(.preinit_array) }
+ .preinit_array ${RELOCATING-0} : { KEEP (*(.preinit_array)) }
${RELOCATING+${CREATE_SHLIB-PROVIDE (__preinit_array_end = .);}}
${RELOCATING+${CREATE_SHLIB-PROVIDE (__init_array_start = .);}}
- .init_array ${RELOCATING-0} : { *(.init_array) }
+ .init_array ${RELOCATING-0} : { KEEP (*(.init_array)) }
${RELOCATING+${CREATE_SHLIB-PROVIDE (__init_array_end = .);}}
${RELOCATING+${CREATE_SHLIB-PROVIDE (__fini_array_start = .);}}
- .fini_array ${RELOCATING-0} : { *(.fini_array) }
+ .fini_array ${RELOCATING-0} : { KEEP (*(.fini_array)) }
${RELOCATING+${CREATE_SHLIB-PROVIDE (__fini_array_end = .);}}
${RELOCATING+${CTOR}}
More information about the Binutils
mailing list