linker script globbing

Alan Modra amodra@bigpond.net.au
Mon Aug 28 03:39:00 GMT 2006


On Fri, Aug 25, 2006 at 11:33:20AM +0100, Nathan Sidwell wrote:
> 	* ldlang.c (walk_wild): Allow * to glob '/' in wildcarded match.

OK.  I'm committing the following which should make your change safe
at least when using the default linker scripts.

	* 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.

Index: ld/scripttempl/elf.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/elf.sc,v
retrieving revision 1.74
diff -u -p -r1.74 elf.sc
--- ld/scripttempl/elf.sc	6 Aug 2006 05:23:16 -0000	1.74
+++ ld/scripttempl/elf.sc	28 Aug 2006 01:25:53 -0000
@@ -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}}
Index: ld/scripttempl/armbpabi.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/armbpabi.sc,v
retrieving revision 1.11
diff -u -p -r1.11 armbpabi.sc
--- ld/scripttempl/armbpabi.sc	11 Dec 2005 00:49:19 -0000	1.11
+++ ld/scripttempl/armbpabi.sc	28 Aug 2006 01:25:52 -0000
@@ -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}}
Index: ld/scripttempl/crisaout.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/crisaout.sc,v
retrieving revision 1.5
diff -u -p -r1.5 crisaout.sc
--- ld/scripttempl/crisaout.sc	14 Apr 2003 13:03:17 -0000	1.5
+++ ld/scripttempl/crisaout.sc	28 Aug 2006 01:25:53 -0000
@@ -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 = .);}
Index: ld/scripttempl/elf32crx.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/elf32crx.sc,v
retrieving revision 1.4
diff -u -p -r1.4 elf32crx.sc
--- ld/scripttempl/elf32crx.sc	22 May 2006 08:49:33 -0000	1.4
+++ ld/scripttempl/elf32crx.sc	28 Aug 2006 01:25:53 -0000
@@ -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 = .; 
Index: ld/scripttempl/elf32sh-symbian.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/elf32sh-symbian.sc,v
retrieving revision 1.5
diff -u -p -r1.5 elf32sh-symbian.sc
--- ld/scripttempl/elf32sh-symbian.sc	11 Dec 2005 00:49:19 -0000	1.5
+++ ld/scripttempl/elf32sh-symbian.sc	28 Aug 2006 01:25:53 -0000
@@ -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}}
Index: ld/scripttempl/elf_chaos.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/elf_chaos.sc,v
retrieving revision 1.5
diff -u -p -r1.5 elf_chaos.sc
--- ld/scripttempl/elf_chaos.sc	11 Dec 2005 00:49:19 -0000	1.5
+++ ld/scripttempl/elf_chaos.sc	28 Aug 2006 01:25:53 -0000
@@ -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}}
Index: ld/scripttempl/elfd10v.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/elfd10v.sc,v
retrieving revision 1.9
diff -u -p -r1.9 elfd10v.sc
--- ld/scripttempl/elfd10v.sc	11 Dec 2005 00:49:19 -0000	1.9
+++ ld/scripttempl/elfd10v.sc	28 Aug 2006 01:25:53 -0000
@@ -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}}
Index: ld/scripttempl/elfd30v.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/elfd30v.sc,v
retrieving revision 1.8
diff -u -p -r1.8 elfd30v.sc
--- ld/scripttempl/elfd30v.sc	11 Dec 2005 00:49:19 -0000	1.8
+++ ld/scripttempl/elfd30v.sc	28 Aug 2006 01:25:53 -0000
@@ -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__ = .; }
Index: ld/scripttempl/elfxtensa.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/elfxtensa.sc,v
retrieving revision 1.9
diff -u -p -r1.9 elfxtensa.sc
--- ld/scripttempl/elfxtensa.sc	25 Aug 2006 00:08:55 -0000	1.9
+++ ld/scripttempl/elfxtensa.sc	28 Aug 2006 01:25:53 -0000
@@ -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}}
Index: ld/scripttempl/iq2000.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/iq2000.sc,v
retrieving revision 1.5
diff -u -p -r1.5 iq2000.sc
--- ld/scripttempl/iq2000.sc	11 Dec 2005 00:49:19 -0000	1.5
+++ ld/scripttempl/iq2000.sc	28 Aug 2006 01:25:54 -0000
@@ -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}}
Index: ld/scripttempl/mmo.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/mmo.sc,v
retrieving revision 1.5
diff -u -p -r1.5 mmo.sc
--- ld/scripttempl/mmo.sc	18 Oct 2003 15:49:10 -0000	1.5
+++ ld/scripttempl/mmo.sc	28 Aug 2006 01:25:54 -0000
@@ -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 = .);}
Index: ld/scripttempl/xstormy16.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/xstormy16.sc,v
retrieving revision 1.9
diff -u -p -r1.9 xstormy16.sc
--- ld/scripttempl/xstormy16.sc	11 Dec 2005 00:49:19 -0000	1.9
+++ ld/scripttempl/xstormy16.sc	28 Aug 2006 01:25:54 -0000
@@ -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}}

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list