From 3cff7cc71fc25ffa83e7d5ce8f4aeb308fb656db Mon Sep 17 00:00:00 2001 From: Jie Zhang Date: Sat, 27 Feb 2010 12:34:25 +0000 Subject: [PATCH] * scripttempl/armbpabi.sc: Don't combine .init_array.* or .fini_array.* when do relocatable linking. * scripttempl/elf.sc: Likewise. * scripttempl/elf32sh-symbian.sc: Likewise. * scripttempl/elf64hppa.sc: Likewise. * scripttempl/elfxtensa.sc: Likewise. testsuite/ * ld-elf/init-fini-arrays.s: New test. * ld-elf/init-fini-arrays.d: New test. --- ld/ChangeLog | 9 ++++++ ld/scripttempl/armbpabi.sc | 38 ++++++++++++++------------ ld/scripttempl/elf.sc | 30 ++++++++++---------- ld/scripttempl/elf32sh-symbian.sc | 30 ++++++++++---------- ld/scripttempl/elf64hppa.sc | 30 ++++++++++---------- ld/scripttempl/elfxtensa.sc | 30 ++++++++++---------- ld/testsuite/ChangeLog | 5 ++++ ld/testsuite/ld-elf/init-fini-arrays.d | 9 ++++++ ld/testsuite/ld-elf/init-fini-arrays.s | 6 ++++ 9 files changed, 113 insertions(+), 74 deletions(-) create mode 100644 ld/testsuite/ld-elf/init-fini-arrays.d create mode 100644 ld/testsuite/ld-elf/init-fini-arrays.s diff --git a/ld/ChangeLog b/ld/ChangeLog index 93471ef221..33487ffc7a 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,12 @@ +2010-02-27 Jie Zhang + + * scripttempl/armbpabi.sc: Don't combine .init_array.* or + .fini_array.* when do relocatable linking. + * scripttempl/elf.sc: Likewise. + * scripttempl/elf32sh-symbian.sc: Likewise. + * scripttempl/elf64hppa.sc: Likewise. + * scripttempl/elfxtensa.sc: Likewise. + 2010-02-26 Alan Modra * scripttempl/elf.sc (.fini_array): Place input .fini_array after diff --git a/ld/scripttempl/armbpabi.sc b/ld/scripttempl/armbpabi.sc index 556ff1e44e..8b3ea0a95a 100644 --- a/ld/scripttempl/armbpabi.sc +++ b/ld/scripttempl/armbpabi.sc @@ -64,6 +64,24 @@ else NO_SMALL_DATA=" " fi test -n "$SEPARATE_GOTPLT" && SEPARATE_GOTPLT=" " +INIT_ARRAY=".init_array ${RELOCATING-0} : + { + /* SymbianOS uses this symbol. */ + ${RELOCATING+PROVIDE (SHT\$\$INIT_ARRAY\$\$Base = .);} + ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__init_array_start = .);}} + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__init_array_end = .);}} + /* SymbianOS uses this symbol. */ + ${RELOCATING+PROVIDE (SHT\$\$INIT_ARRAY\$\$Limit = .);} + }" +FINI_ARRAY=".fini_array ${RELOCATING-0} : + { + ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__fini_array_start = .);}} + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array)) + ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__fini_array_end = .);}} + }" CTOR=".ctors ${CONSTRUCTING-0} : { ${CONSTRUCTING+${CTOR_START}} @@ -218,24 +236,8 @@ cat <