diff options
-rw-r--r-- | ld/ChangeLog | 5 | ||||
-rw-r--r-- | ld/scripttempl/elfarc.sc | 24 |
2 files changed, 21 insertions, 8 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 0e03aa1ed1a..13919b245bb 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2020-07-31 Shahab Vahedi <shahab@synopsys.com> + + * scripttempl/elfarc.sc (.init_array): Keep ".init_array.*". + (.fini_array): Keep ".fini_array.*". + 2020-07-30 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> * Makefile.am (AM_CPPFLAGS): Add LARGEFILE_CPPFLAGS. diff --git a/ld/scripttempl/elfarc.sc b/ld/scripttempl/elfarc.sc index 8851c771f22..ebf40b84528 100644 --- a/ld/scripttempl/elfarc.sc +++ b/ld/scripttempl/elfarc.sc @@ -118,6 +118,20 @@ if test -z "${NO_SMALL_DATA}"; then REL_SBSS2=".rel.sbss2 ${RELOCATING-0} : { *(.rel.sbss2${RELOCATING+ .rel.sbss2.* .rel.gnu.linkonce.sb2.*}) } .rela.sbss2 ${RELOCATING-0} : { *(.rela.sbss2${RELOCATING+ .rela.sbss2.* .rela.gnu.linkonce.sb2.*}) }" fi +INIT_ARRAY=".init_array ${RELOCATING-0} : + { + ${RELOCATING+${CREATE_SHLIB-PROVIDE (__init_array_start = .);}} + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + ${RELOCATING+${CREATE_SHLIB-PROVIDE (__init_array_end = .);}} + }" +FINI_ARRAY=".fini_array ${RELOCATING-0} : + { + ${RELOCATING+${CREATE_SHLIB-PROVIDE (__fini_array_start = .);}} + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array)) + ${RELOCATING+${CREATE_SHLIB-PROVIDE (__fini_array_end = .);}} + }" CTOR=".ctors ${CONSTRUCTING-0} : { ${CONSTRUCTING+${CTOR_START}} @@ -314,14 +328,8 @@ cat <<EOF ${RELOCATING+${CREATE_SHLIB-PROVIDE (__preinit_array_start = .);}} .preinit_array ${RELOCATING-0} : { *(.preinit_array) } ${RELOCATING+${CREATE_SHLIB-PROVIDE (__preinit_array_end = .);}} - - ${RELOCATING+${CREATE_SHLIB-PROVIDE (__init_array_start = .);}} - .init_array ${RELOCATING-0} : { *(.init_array) } - ${RELOCATING+${CREATE_SHLIB-PROVIDE (__init_array_end = .);}} - - ${RELOCATING+${CREATE_SHLIB-PROVIDE (__fini_array_start = .);}} - .fini_array ${RELOCATING-0} : { *(.fini_array) } - ${RELOCATING+${CREATE_SHLIB-PROVIDE (__fini_array_end = .);}} + ${RELOCATING+${INIT_ARRAY}} + ${RELOCATING+${FINI_ARRAY}} .data ${RELOCATING-0} : { |