This is the mail archive of the binutils@sourceware.org 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]

[patch] use correct compiler based on source in ld selective.exp


the selective.exp uses $CC when calling ld_compile even when it knows it is 
compiling a C++ file.  this causes ld_compile to add $CFLAGS instead of 
$CXXFLAGS to the call to the compiler which may fail when $CFLAGS contains 
things that the C++ compiler rejects.  attached patch fixes that by calling 
ld_compile with $CC or $CXX depending on the $testtype.

2007-09-29  Mike Frysinger  <vapier@gentoo.org>

	* ld-selective/selective.exp: Set $compiler based on $testtype and
	use that instead of $CC.

-mike

Attachment: signature.asc
Description: This is a digitally signed message part.

2007-09-29  Mike Frysinger  <vapier@gentoo.org>

	* ld-selective/selective.exp: Set $compiler based on $testtype and
	use that instead of $CC.

Index: ld-selective/selective.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-selective/selective.exp,v
retrieving revision 1.38
diff -u -p -r1.38 selective.exp
--- ld-selective/selective.exp	28 Aug 2007 13:21:58 -0000	1.38
+++ ld-selective/selective.exp	30 Sep 2007 01:45:19 -0000
@@ -100,6 +100,7 @@ foreach testitem $seltests {
     # It's either C or C++ at the moment.
     if { $testtype == "C++" } {
 	set testflags "$cflags $cxxflags"
+	set compiler "$CXX"
 	if [string match "*gcc*" [lindex $CC 0]] {
 	    # Starting with 3.4.0, -fvtable-gc is no longer supported and thus
 	    # the functionality we try to test for cannot be expected to work.
@@ -111,19 +112,20 @@ foreach testitem $seltests {
 	}
     } {
 	set testflags "$cflags"
+	set compiler "$CC"
     }
 
     # Note that we do not actually *use* CXX; we just add cxxflags for C++
     # tests.  It might have been a buglet originally; now I think better
     # leave as is.
-    if { ![ld_compile "$CC $testflags" $srcdir/$subdir/$testfile $objfile] } {
+    if { ![ld_compile "$compiler $testflags" $srcdir/$subdir/$testfile $objfile] } {
 	unresolved $testname
 	continue
     }
 
     # V850 targets need libgcc.a
     if [istarget v850*-*-elf] {
-	set libgcc [remote_exec host "$CC -print-libgcc-file-name"]
+	set libgcc [remote_exec host "$compiler -print-libgcc-file-name"]
 	set libgcc [lindex $libgcc 1]
 	regsub -all "\[\r\n\]" $libgcc "" libgcc
 	set objfile "$objfile $libgcc"
@@ -131,7 +133,7 @@ foreach testitem $seltests {
 
     # ARM targets need libgcc.a in THUMB mode so that __call_via_r3 is provided
     if {[istarget arm-*-*] || [istarget xscale-*-*]} {
-	set libgcc [remote_exec host "$CC -print-libgcc-file-name"]
+	set libgcc [remote_exec host "$compiler -print-libgcc-file-name"]
 	set libgcc [lindex $libgcc 1]
 	regsub -all "\[\r\n\]" $libgcc "" libgcc
 	set objfile "$objfile $libgcc"
@@ -139,7 +141,7 @@ foreach testitem $seltests {
 
     # HPPA linux targets need libgcc.a for millicode routines ($$dyncall).
     if [istarget hppa*-*-linux*] {
-	set libgcc [remote_exec host "$CC -print-libgcc-file-name"]
+	set libgcc [remote_exec host "$compiler -print-libgcc-file-name"]
 	set libgcc [lindex $libgcc 1]
 	regsub -all "\[\r\n\]" $libgcc "" libgcc
 	set objfile "$objfile $libgcc"

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