This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: One type of failure running ld testsuite on cygwin: ld-new:unrecognized option'-B/usr/local/src/gcc-binutils/trunk/objdir-binutils/ld/tmpdir/ld


On Tue, Jun 17, 2003 at 10:16:14PM +0200, Christian Joensson wrote:
> /usr/local/src/gcc-binutils/trunk/objdir-binutils/ld/ld-new
> -B/usr/local/src/gcc-binutils/trunk/objdir-binutils/ld/tmpdir/ld/
> -L/usr/local/gcc-binutils/pentium4-cygwin/lib -L/usr/local/gcc-binutils/lib
> -L/usr/lib -L/usr/lib/w32api  -o tmpdir/asm.x --check-sections tmpdir/asm.o
> /usr/local/src/gcc-binutils/trunk/objdir-binutils/ld/ld-new: unrecognized
> option '-B/usr/local/src/gcc-binutils/trunk/objdir-binutils/ld/tmpdir/ld/'
> /usr/local/src/gcc-binutils/trunk/objdir-binutils/ld/ld-new: use the --help
> option for usage information
[snip]

> Any ideas of what is causing the FAIL? Is it due to the -B directive (a gcc
> directive, right?)?

Yeah, it's this bit of crummy code in ld-lib.exp

    # If we are compiling with gcc, we want to add gcc_ld_flag to
    # flags.  Rather than determine this in some complex way, we guess
    # based on the name of the compiler.
    if {[string match "*gcc*" $ld] || [string match "*++*" $ld]} then {
	set flags "$gcc_ld_flag $flags"
    }

You get a match on your path, which has a "gcc-binutils" component..

This should fix it.

	* lib/ld-lib.exp (default_ld_simple_link): Trim ld path before looking
	for gcc match.
	(default_ld_compile): Likewise for cc.

Index: ld/testsuite/lib/ld-lib.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/lib/ld-lib.exp,v
retrieving revision 1.22
diff -u -p -r1.22 ld-lib.exp
--- ld/testsuite/lib/ld-lib.exp	29 May 2003 00:16:46 -0000	1.22
+++ ld/testsuite/lib/ld-lib.exp	17 Jun 2003 23:18:13 -0000
@@ -170,7 +170,8 @@ proc default_ld_simple_link { ld target 
     # If we are compiling with gcc, we want to add gcc_ld_flag to
     # flags.  Rather than determine this in some complex way, we guess
     # based on the name of the compiler.
-    if {[string match "*gcc*" $ld] || [string match "*++*" $ld]} then {
+    set ldexe [string replace $ld 0 [string last "/" $ld] ""]
+    if {[string match "*gcc*" $ldexe] || [string match "*++*" $ldexe]} then {
 	set flags "$gcc_ld_flag $flags"
     }
 
@@ -218,7 +219,8 @@ proc default_ld_compile { cc source obje
     # If we are compiling with gcc, we want to add gcc_gas_flag to
     # flags.  Rather than determine this in some complex way, we guess
     # based on the name of the compiler.
-    if {[string match "*gcc*" $cc] || [string match "*++*" $cc]} then {
+    set ccexe [string replace $cc 0 [string last "/" $cc] ""]
+    if {[string match "*gcc*" $ccexe] || [string match "*++*" $ccexe]} then {
 	set flags "$gcc_gas_flag $flags"
     }
 

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]