public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* linker script globbing
@ 2006-08-25 11:16 Nathan Sidwell
  2006-08-25 12:18 ` Andreas Schwab
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Nathan Sidwell @ 2006-08-25 11:16 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 1798 bytes --]

Whilst tracking down a separate linker bug I found a problem with input section 
filename globbing.  Namely, something like:
	*crtbegin.o(.ctors)     /* 1 */
	*(EXCLUDE(*crtend.o) .ctors) /* 2 */
	*crtend.o(.ctors)	/* 3 */

would behave oddly when the linker is given full pathnames for crtbegin.o and 
crtend.o (as it usually is).

Statement #1 would NOT match /path/to/crtbegin.o, because the fnmatch used 
explicitly prevents '*' matching '/'.  So statement 1 selects no sections.

Statement #2 selects all .o files, because a naked '*' does match everything. 
The EXCLUDE clause does match /path/to/crtend.o, because that fnmatch does allow 
'*' to glob '/'.  So statement 1 selects /path/to/crtbegin.o (because it wasn't 
already selected), and any other object files with .ctors sections.

Statement #3 behaves as statement #1, and does not select /path/to/crtend.o, so 
crtend.o remains out of the link. Looking at the scripttemplates, they work 
around this by writing statement #3 as '*(.ctors)', and thereby catch any 
previously unselected .ctors sections -- which should just be the crtend.o one.

Statement #2 works because gcc always provides crtbegin.o early on the link 
line, and the linker preserves order. The linker map file so produced, does look 
a bit strange in that statement 1 didn't select crtbegin:

*crtbegin*.o(.ctors)
*(EXCLUDE_FILE(*crtend*.o) .ctors)
   .ctors 0x00002f90 0x4 /path/to/crtbegin.o

Examining the fnmatch calls in ldlang.c, I find that all but one allow '/' to be 
globbed.  This patch changes the remaining call to allow such globbing 
everywhere, and therefore be consistent.

ok?

nathan

-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::         CodeSourcery
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk


[-- Attachment #2: glob.patch --]
[-- Type: text/x-patch, Size: 819 bytes --]

2006-08-25  Nathan Sidwell  <nathan@codesourcery.com>

	* ldlang.c (walk_wild): Allow * to glob '/' in wildcarded match.

Index: ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.236
diff -c -3 -p -r1.236 ldlang.c
*** ldlang.c	24 Aug 2006 14:59:24 -0000	1.236
--- ldlang.c	25 Aug 2006 10:07:42 -0000
*************** walk_wild (lang_wild_statement_type *s, 
*** 791,797 ****
      {
        LANG_FOR_EACH_INPUT_STATEMENT (f)
  	{
! 	  if (fnmatch (file_spec, f->filename, FNM_FILE_NAME) == 0)
  	    walk_wild_file (s, f, callback, data);
  	}
      }
--- 791,797 ----
      {
        LANG_FOR_EACH_INPUT_STATEMENT (f)
  	{
! 	  if (fnmatch (file_spec, f->filename, 0) == 0)
  	    walk_wild_file (s, f, callback, data);
  	}
      }

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: linker script globbing
  2006-08-25 11:16 linker script globbing Nathan Sidwell
@ 2006-08-25 12:18 ` Andreas Schwab
  2006-08-25 14:44   ` Andreas Schwab
  2006-08-25 19:52 ` Ian Lance Taylor
  2006-08-28  3:39 ` Alan Modra
  2 siblings, 1 reply; 7+ messages in thread
From: Andreas Schwab @ 2006-08-25 12:18 UTC (permalink / raw)
  To: Nathan Sidwell; +Cc: binutils

Nathan Sidwell <nathan@codesourcery.com> writes:

> Whilst tracking down a separate linker bug I found a problem with input
> section filename globbing.  Namely, something like:
> 	*crtbegin.o(.ctors)     /* 1 */
> 	*(EXCLUDE(*crtend.o) .ctors) /* 2 */
> 	*crtend.o(.ctors)	/* 3 */
>
> would behave oddly when the linker is given full pathnames for crtbegin.o
> and crtend.o (as it usually is).
>
> Statement #1 would NOT match /path/to/crtbegin.o, because the fnmatch used
> explicitly prevents '*' matching '/'.  So statement 1 selects no sections.

Why is '*' not matching the empty string?  Looks like a bug in fnmatch.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: linker script globbing
  2006-08-25 12:18 ` Andreas Schwab
@ 2006-08-25 14:44   ` Andreas Schwab
  0 siblings, 0 replies; 7+ messages in thread
From: Andreas Schwab @ 2006-08-25 14:44 UTC (permalink / raw)
  To: Nathan Sidwell; +Cc: binutils

Andreas Schwab <schwab@suse.de> writes:

> Why is '*' not matching the empty string?  Looks like a bug in fnmatch.

Ignore that, thinko on my side.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: linker script globbing
  2006-08-25 11:16 linker script globbing Nathan Sidwell
  2006-08-25 12:18 ` Andreas Schwab
@ 2006-08-25 19:52 ` Ian Lance Taylor
  2006-08-28  3:39 ` Alan Modra
  2 siblings, 0 replies; 7+ messages in thread
From: Ian Lance Taylor @ 2006-08-25 19:52 UTC (permalink / raw)
  To: Nathan Sidwell; +Cc: binutils

Nathan Sidwell <nathan@codesourcery.com> writes:

> Whilst tracking down a separate linker bug I found a problem with
> input section filename globbing.  Namely, something like:
> 	*crtbegin.o(.ctors)     /* 1 */
> 	*(EXCLUDE(*crtend.o) .ctors) /* 2 */
> 	*crtend.o(.ctors)	/* 3 */
> 
> would behave oddly when the linker is given full pathnames for
> crtbegin.o and crtend.o (as it usually is).
> 

FYI, I also noticed this last month:
    http://sourceware.org/ml/binutils/2006-07/msg00239.html

I tend to think that we should remove FNM_FILE_NAME, but I'll let
somebody else decide whether to approve the patch.

Ian

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: linker script globbing
  2006-08-25 11:16 linker script globbing Nathan Sidwell
  2006-08-25 12:18 ` Andreas Schwab
  2006-08-25 19:52 ` Ian Lance Taylor
@ 2006-08-28  3:39 ` Alan Modra
  2006-08-29 11:41   ` Nathan Sidwell
  2 siblings, 1 reply; 7+ messages in thread
From: Alan Modra @ 2006-08-28  3:39 UTC (permalink / raw)
  To: Nathan Sidwell; +Cc: binutils

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: linker script globbing
  2006-08-28  3:39 ` Alan Modra
@ 2006-08-29 11:41   ` Nathan Sidwell
  2006-08-29 11:58     ` Alan Modra
  0 siblings, 1 reply; 7+ messages in thread
From: Nathan Sidwell @ 2006-08-29 11:41 UTC (permalink / raw)
  To: Nathan Sidwell, binutils

Alan Modra wrote:
> 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.

thanks.  What about my patch itself?  It seems Ian's in favour and I take it 
your change means you are.

nathan

-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::         CodeSourcery
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: linker script globbing
  2006-08-29 11:41   ` Nathan Sidwell
@ 2006-08-29 11:58     ` Alan Modra
  0 siblings, 0 replies; 7+ messages in thread
From: Alan Modra @ 2006-08-29 11:58 UTC (permalink / raw)
  To: Nathan Sidwell; +Cc: binutils

On Tue, Aug 29, 2006 at 12:09:19PM +0100, Nathan Sidwell wrote:
> Alan Modra wrote:
> >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.
> 
> thanks.  What about my patch itself?  It seems Ian's in favour and I take 
> it your change means you are.

Yes, please commit.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-08-29 11:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-25 11:16 linker script globbing Nathan Sidwell
2006-08-25 12:18 ` Andreas Schwab
2006-08-25 14:44   ` Andreas Schwab
2006-08-25 19:52 ` Ian Lance Taylor
2006-08-28  3:39 ` Alan Modra
2006-08-29 11:41   ` Nathan Sidwell
2006-08-29 11:58     ` Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).