From: Alan Modra Date: Mon, 28 Aug 2006 01:52:56 +0000 (+0000) Subject: * scripttempl/elf.sc: Ensure that crtbegin and crtend entries will X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=40cf2291a7723a4ffa2db698bcfc2c059427501b;p=binutils-gdb.git * 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. --- diff --git a/ld/ChangeLog b/ld/ChangeLog index 6c972542315..0ee5e613cd8 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 c8d1bd4ba59..28bad1c4623 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 acdca7a9122..186fac765da 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 28a94fe835e..a54ff58c039 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 63401fe7e2c..430418744f9 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 1bcac18106a..ac10ceb96e0 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 167b7124ef6..754e10032ea 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 6145fda4550..a4c907b44a8 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 924414d509d..b5db0e6ca91 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 63c8e8c6c9a..b76bc1482a7 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 b0872643153..b1e0cf4bfac 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 643b349539e..599db83199d 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 dd7c52cb9d4..9008f5ce8e0 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}}