From c245f5cfce35346ac9f6d7ef148c481d8fe97706 Mon Sep 17 00:00:00 2001 From: amodra Date: Mon, 28 Aug 2006 01:52:53 +0000 Subject: [PATCH] * scripttempl/elf.sc: Ensure that crtbegin and crtend entries will not match random object files in a path containing "crtbegin" or "crtend" as part of a directory name. * scripttempl/armbpabi.sc: Likewise. * scripttempl/crisaout.sc: Likewise. * scripttempl/elf32crx.sc: Likewise. * scripttempl/elf32sh-symbian.sc: Likewise. * scripttempl/elf_chaos.sc: Likewise. * scripttempl/elfd10v.sc: Likewise. * scripttempl/elfd30v.sc: Likewise. * scripttempl/elfxtensa.sc: Likewise. * scripttempl/iq2000.sc: Likewise. * scripttempl/mmo.sc: Likewise. * scripttempl/xstormy16.sc: Likewise. --- ld/ChangeLog | 17 +++++++++++++++++ ld/scripttempl/armbpabi.sc | 10 ++++++---- ld/scripttempl/crisaout.sc | 10 ++++++---- ld/scripttempl/elf.sc | 10 ++++++---- ld/scripttempl/elf32crx.sc | 12 +++++++----- ld/scripttempl/elf32sh-symbian.sc | 10 ++++++---- ld/scripttempl/elf_chaos.sc | 10 ++++++---- ld/scripttempl/elfd10v.sc | 10 ++++++---- ld/scripttempl/elfd30v.sc | 10 ++++++---- ld/scripttempl/elfxtensa.sc | 10 ++++++---- ld/scripttempl/iq2000.sc | 10 ++++++---- ld/scripttempl/mmo.sc | 10 ++++++---- ld/scripttempl/xstormy16.sc | 10 ++++++---- 13 files changed, 90 insertions(+), 49 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 6c97254231..0ee5e613cd 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,20 @@ +2006-08-28 Alan Modra + + * scripttempl/elf.sc: Ensure that crtbegin and crtend entries will + not match random object files in a path containing "crtbegin" or + "crtend" as part of a directory name. + * scripttempl/armbpabi.sc: Likewise. + * scripttempl/crisaout.sc: Likewise. + * scripttempl/elf32crx.sc: Likewise. + * scripttempl/elf32sh-symbian.sc: Likewise. + * scripttempl/elf_chaos.sc: Likewise. + * scripttempl/elfd10v.sc: Likewise. + * scripttempl/elfd30v.sc: Likewise. + * scripttempl/elfxtensa.sc: Likewise. + * scripttempl/iq2000.sc: Likewise. + * scripttempl/mmo.sc: Likewise. + * scripttempl/xstormy16.sc: Likewise. + 2006-08-24 Bob Wilson * emulparams/elf32xtensa.sh (.xt.prop): Add .xt.prop.*. diff --git a/ld/scripttempl/armbpabi.sc b/ld/scripttempl/armbpabi.sc index c8d1bd4ba5..28bad1c462 100644 --- a/ld/scripttempl/armbpabi.sc +++ b/ld/scripttempl/armbpabi.sc @@ -77,14 +77,15 @@ CTOR=".ctors ${CONSTRUCTING-0} : doesn't matter which directory crtbegin.o is in. */ - KEEP (*crtbegin*.o(.ctors)) + KEEP (*crtbegin.o(.ctors)) + KEEP (*crtbegin?.o(.ctors)) /* We don't want to include the .ctor section from the crtend.o file until after the sorted ctors. The .ctor section from the crtend file contains the end of ctors marker and it must be last */ - KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors)) KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) ${CONSTRUCTING+${CTOR_END}} @@ -92,8 +93,9 @@ CTOR=".ctors ${CONSTRUCTING-0} : DTOR=".dtors ${CONSTRUCTING-0} : { ${CONSTRUCTING+${DTOR_START}} - KEEP (*crtbegin*.o(.dtors)) - KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .dtors)) + KEEP (*crtbegin.o(.dtors)) + KEEP (*crtbegin?.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors)) KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) ${CONSTRUCTING+${DTOR_END}} diff --git a/ld/scripttempl/crisaout.sc b/ld/scripttempl/crisaout.sc index acdca7a912..186fac765d 100644 --- a/ld/scripttempl/crisaout.sc +++ b/ld/scripttempl/crisaout.sc @@ -48,15 +48,17 @@ SECTIONS /* Cater to linking from ELF. */ ${CONSTRUCTING+ PROVIDE(___ctors = .);} ${CONSTRUCTING+ ___elf_ctors_dtors_begin = .;} - ${CONSTRUCTING+ KEEP (*crtbegin*.o(.ctors))} - ${CONSTRUCTING+ KEEP (*(EXCLUDE_FILE (*crtend*.o) .ctors))} + ${CONSTRUCTING+ KEEP (*crtbegin.o(.ctors))} + ${CONSTRUCTING+ KEEP (*crtbegin?.o(.ctors))} + ${CONSTRUCTING+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .ctors))} ${CONSTRUCTING+ KEEP (*(SORT(.ctors.*)))} ${CONSTRUCTING+ KEEP (*(.ctors))} ${CONSTRUCTING+ PROVIDE(___ctors_end = .);} ${CONSTRUCTING+ PROVIDE(___dtors = .);} - ${CONSTRUCTING+ KEEP (*crtbegin*.o(.dtors))} - ${CONSTRUCTING+ KEEP (*(EXCLUDE_FILE (*crtend*.o) .dtors))} + ${CONSTRUCTING+ KEEP (*crtbegin.o(.dtors))} + ${CONSTRUCTING+ KEEP (*crtbegin?.o(.dtors))} + ${CONSTRUCTING+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .dtors))} ${CONSTRUCTING+ KEEP (*(SORT(.dtors.*)))} ${CONSTRUCTING+ KEEP (*(.dtors))} ${CONSTRUCTING+ PROVIDE(___dtors_end = .);} diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc index 28a94fe835..a54ff58c03 100644 --- a/ld/scripttempl/elf.sc +++ b/ld/scripttempl/elf.sc @@ -203,14 +203,15 @@ CTOR=".ctors ${CONSTRUCTING-0} : doesn't matter which directory crtbegin.o is in. */ - KEEP (*crtbegin*.o(.ctors)) + KEEP (*crtbegin.o(.ctors)) + KEEP (*crtbegin?.o(.ctors)) /* We don't want to include the .ctor section from the crtend.o file until after the sorted ctors. The .ctor section from the crtend file contains the end of ctors marker and it must be last */ - KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors)) KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) ${CONSTRUCTING+${CTOR_END}} @@ -218,8 +219,9 @@ CTOR=".ctors ${CONSTRUCTING-0} : DTOR=".dtors ${CONSTRUCTING-0} : { ${CONSTRUCTING+${DTOR_START}} - KEEP (*crtbegin*.o(.dtors)) - KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .dtors)) + KEEP (*crtbegin.o(.dtors)) + KEEP (*crtbegin?.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors)) KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) ${CONSTRUCTING+${DTOR_END}} diff --git a/ld/scripttempl/elf32crx.sc b/ld/scripttempl/elf32crx.sc index 63401fe7e2..430418744f 100644 --- a/ld/scripttempl/elf32crx.sc +++ b/ld/scripttempl/elf32crx.sc @@ -90,14 +90,15 @@ SECTIONS doesn't matter which directory crtbegin.o is in. */ - KEEP (*crtbegin*.o(.ctors)) - + KEEP (*crtbegin.o(.ctors)) + KEEP (*crtbegin?.o(.ctors)) + /* We don't want to include the .ctor section from the crtend.o file until after the sorted ctors. The .ctor section from the crtend file contains the end of ctors marker and it must be last */ - KEEP (*(EXCLUDE_FILE (*crtend*.o) .ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .ctors)) KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) __CTOR_END = .; @@ -106,8 +107,9 @@ SECTIONS .dtor ALIGN(4) : { __DTOR_START = .; - KEEP (*crtbegin*.o(.dtors)) - KEEP (*(EXCLUDE_FILE (*crtend*.o) .dtors)) + KEEP (*crtbegin.o(.dtors)) + KEEP (*crtbegin?.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .dtors)) KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) __DTOR_END = .; diff --git a/ld/scripttempl/elf32sh-symbian.sc b/ld/scripttempl/elf32sh-symbian.sc index 1bcac18106..ac10ceb96e 100644 --- a/ld/scripttempl/elf32sh-symbian.sc +++ b/ld/scripttempl/elf32sh-symbian.sc @@ -96,14 +96,15 @@ CTOR=".ctors ALIGN(4) : doesn't matter which directory crtbegin.o is in. */ - KEEP (*crtbegin*.o(.ctors)) + KEEP (*crtbegin.o(.ctors)) + KEEP (*crtbegin?.o(.ctors)) /* We don't want to include the .ctor section from the crtend.o file until after the sorted ctors. The .ctor section from the crtend file contains the end of ctors marker and it must be last */ - KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors)) KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) ${CONSTRUCTING+${CTOR_END}} @@ -111,8 +112,9 @@ CTOR=".ctors ALIGN(4) : DTOR=".dtors ALIGN(4) : { ${CONSTRUCTING+${DTOR_START}} - KEEP (*crtbegin*.o(.dtors)) - KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .dtors)) + KEEP (*crtbegin.o(.dtors)) + KEEP (*crtbegin?.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors)) KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) ${CONSTRUCTING+${DTOR_END}} diff --git a/ld/scripttempl/elf_chaos.sc b/ld/scripttempl/elf_chaos.sc index 167b7124ef..754e10032e 100644 --- a/ld/scripttempl/elf_chaos.sc +++ b/ld/scripttempl/elf_chaos.sc @@ -115,22 +115,24 @@ CTOR=" doesn't matter which directory crtbegin.o is in. */ - KEEP (*crtbegin*.o(.ctors)) + KEEP (*crtbegin.o(.ctors)) + KEEP (*crtbegin?.o(.ctors)) /* We don't want to include the .ctor section from the crtend.o file until after the sorted ctors. The .ctor section from the crtend file contains the end of ctors marker and it must be last */ - KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors)) KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) ${CONSTRUCTING+${CTOR_END}} " DTOR=" ${CONSTRUCTING+${DTOR_START}} - KEEP (*crtbegin*.o(.dtors)) - KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .dtors)) + KEEP (*crtbegin.o(.dtors)) + KEEP (*crtbegin?.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors)) KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) ${CONSTRUCTING+${DTOR_END}} diff --git a/ld/scripttempl/elfd10v.sc b/ld/scripttempl/elfd10v.sc index 6145fda455..a4c907b44a 100644 --- a/ld/scripttempl/elfd10v.sc +++ b/ld/scripttempl/elfd10v.sc @@ -20,14 +20,15 @@ CTOR=".ctors ${CONSTRUCTING-0} : doesn't matter which directory crtbegin.o is in. */ - KEEP (*crtbegin*.o(.ctors)) + KEEP (*crtbegin.o(.ctors)) + KEEP (*crtbegin?.o(.ctors)) /* We don't want to include the .ctor section from the crtend.o file until after the sorted ctors. The .ctor section from the crtend file contains the end of ctors marker and it must be last */ - KEEP (*(EXCLUDE_FILE (*crtend*.o) .ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .ctors)) KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) ${CONSTRUCTING+${CTOR_END}} @@ -36,8 +37,9 @@ CTOR=".ctors ${CONSTRUCTING-0} : DTOR=" .dtors ${CONSTRUCTING-0} : { ${CONSTRUCTING+${DTOR_START}} - KEEP (*crtbegin*.o(.dtors)) - KEEP (*(EXCLUDE_FILE (*crtend*.o) .dtors)) + KEEP (*crtbegin.o(.dtors)) + KEEP (*crtbegin?.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .dtors)) KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) ${CONSTRUCTING+${DTOR_END}} diff --git a/ld/scripttempl/elfd30v.sc b/ld/scripttempl/elfd30v.sc index 924414d509..b5db0e6ca9 100644 --- a/ld/scripttempl/elfd30v.sc +++ b/ld/scripttempl/elfd30v.sc @@ -12,14 +12,15 @@ CTOR=".ctors ${CONSTRUCTING-0} : doesn't matter which directory crtbegin.o is in. */ - KEEP (*crtbegin*.o(.ctors)) + KEEP (*crtbegin.o(.ctors)) + KEEP (*crtbegin?.o(.ctors)) /* We don't want to include the .ctor section from the crtend.o file until after the sorted ctors. The .ctor section from the crtend file contains the end of ctors marker and it must be last */ - KEEP (*(EXCLUDE_FILE (*crtend*.o) .ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .ctors)) KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) ${CONSTRUCTING+ __CTOR_END__ = .; } @@ -28,8 +29,9 @@ CTOR=".ctors ${CONSTRUCTING-0} : DTOR=" .dtors ${CONSTRUCTING-0} : { ${CONSTRUCTING+ __DTOR_LIST__ = .; } - KEEP (*crtbegin*.o(.dtors)) - KEEP (*(EXCLUDE_FILE (*crtend*.o) .dtors)) + KEEP (*crtbegin.o(.dtors)) + KEEP (*crtbegin?.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .dtors)) KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) ${CONSTRUCTING+ __DTOR_END__ = .; } diff --git a/ld/scripttempl/elfxtensa.sc b/ld/scripttempl/elfxtensa.sc index 63c8e8c6c9..b76bc1482a 100644 --- a/ld/scripttempl/elfxtensa.sc +++ b/ld/scripttempl/elfxtensa.sc @@ -173,14 +173,15 @@ CTOR=".ctors ${CONSTRUCTING-0} : doesn't matter which directory crtbegin.o is in. */ - KEEP (*crtbegin*.o(.ctors)) + KEEP (*crtbegin.o(.ctors)) + KEEP (*crtbegin?.o(.ctors)) /* We don't want to include the .ctor section from the crtend.o file until after the sorted ctors. The .ctor section from the crtend file contains the end of ctors marker and it must be last */ - KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors)) KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) ${CONSTRUCTING+${CTOR_END}} @@ -188,8 +189,9 @@ CTOR=".ctors ${CONSTRUCTING-0} : DTOR=".dtors ${CONSTRUCTING-0} : { ${CONSTRUCTING+${DTOR_START}} - KEEP (*crtbegin*.o(.dtors)) - KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .dtors)) + KEEP (*crtbegin.o(.dtors)) + KEEP (*crtbegin?.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors)) KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) ${CONSTRUCTING+${DTOR_END}} diff --git a/ld/scripttempl/iq2000.sc b/ld/scripttempl/iq2000.sc index b087264315..b1e0cf4bfa 100644 --- a/ld/scripttempl/iq2000.sc +++ b/ld/scripttempl/iq2000.sc @@ -83,14 +83,15 @@ CTOR=".ctors ${CONSTRUCTING-0} : doesn't matter which directory crtbegin.o is in. */ - KEEP (*crtbegin*.o(.ctors)) + KEEP (*crtbegin.o(.ctors)) + KEEP (*crtbegin?.o(.ctors)) /* We don't want to include the .ctor section from the crtend.o file until after the sorted ctors. The .ctor section from the crtend file contains the end of ctors marker and it must be last */ - KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors)) KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) ${CONSTRUCTING+${CTOR_END}} @@ -99,8 +100,9 @@ CTOR=".ctors ${CONSTRUCTING-0} : DTOR=" .dtors ${CONSTRUCTING-0} : { ${CONSTRUCTING+${DTOR_START}} - KEEP (*crtbegin*.o(.dtors)) - KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .dtors)) + KEEP (*crtbegin.o(.dtors)) + KEEP (*crtbegin?.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors)) KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) ${CONSTRUCTING+${DTOR_END}} diff --git a/ld/scripttempl/mmo.sc b/ld/scripttempl/mmo.sc index 643b349539..599db83199 100644 --- a/ld/scripttempl/mmo.sc +++ b/ld/scripttempl/mmo.sc @@ -29,8 +29,9 @@ SECTIONS ${RELOCATING+ PROVIDE (__ctors_start = .);} ${RELOCATING+ PROVIDE (_ctors = .);} ${RELOCATING+ PROVIDE (__ctors = .);} - ${RELOCATING+ KEEP (*crtbegin*.o(.ctors))} - ${RELOCATING+ KEEP (*(EXCLUDE_FILE (*crtend*.o) .ctors))} + ${RELOCATING+ KEEP (*crtbegin.o(.ctors))} + ${RELOCATING+ KEEP (*crtbegin?.o(.ctors))} + ${RELOCATING+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .ctors))} ${RELOCATING+ KEEP (*(SORT(.ctors.*)))} ${RELOCATING+ KEEP (*(.ctors))} ${RELOCATING+ PROVIDE (_ctors_end = .);} @@ -40,8 +41,9 @@ SECTIONS ${RELOCATING+ PROVIDE (__dtors_start = .);} ${RELOCATING+ PROVIDE (_dtors = .);} ${RELOCATING+ PROVIDE (__dtors = .);} - ${RELOCATING+ KEEP (*crtbegin*.o(.dtors))} - ${RELOCATING+ KEEP (*(EXCLUDE_FILE (*crtend*.o) .dtors))} + ${RELOCATING+ KEEP (*crtbegin.o(.dtors))} + ${RELOCATING+ KEEP (*crtbegin?.o(.dtors))} + ${RELOCATING+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .dtors))} ${RELOCATING+ KEEP (*(SORT(.dtors.*)))} ${RELOCATING+ KEEP (*(.dtors))} ${RELOCATING+ PROVIDE (_dtors_end = .);} diff --git a/ld/scripttempl/xstormy16.sc b/ld/scripttempl/xstormy16.sc index dd7c52cb9d..9008f5ce8e 100644 --- a/ld/scripttempl/xstormy16.sc +++ b/ld/scripttempl/xstormy16.sc @@ -67,14 +67,15 @@ CTOR=".ctors ${CONSTRUCTING-0} : doesn't matter which directory crtbegin.o is in. */ - KEEP (*crtbegin*.o(.ctors)) + KEEP (*crtbegin.o(.ctors)) + KEEP (*crtbegin?.o(.ctors)) /* We don't want to include the .ctor section from the crtend.o file until after the sorted ctors. The .ctor section from the crtend file contains the end of ctors marker and it must be last */ - KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors)) KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) ${CONSTRUCTING+${CTOR_END}} @@ -83,8 +84,9 @@ CTOR=".ctors ${CONSTRUCTING-0} : DTOR=" .dtors ${CONSTRUCTING-0} : { ${CONSTRUCTING+${DTOR_START}} - KEEP (*crtbegin*.o(.dtors)) - KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .dtors)) + KEEP (*crtbegin.o(.dtors)) + KEEP (*crtbegin?.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors)) KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) ${CONSTRUCTING+${DTOR_END}} -- 2.11.0