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] |
On Tuesday 28 August 2007, Mike Frysinger wrote: > i fetched binutils-2.18 and ran it through some `make check` only to find > ld oddly failling some tests on me ... after digging through it a bit, it > seems it's due to mixing of CFLAGS and CXXFLAGS. > > on my system, i throw -Wimplicit-function-declaration into my CFLAGS which > does two things: (1) shows me implicit functions so i can send patches to > fix code and (2) see when packages wrongly mix CFLAGS and CXXFLAGS. > > in ld/testsuite/lib/ld-lib.exp, the ld_compile function will append $CFLAGS > to all commands given it. this means even tests like ld-cdtest which > compiles C++ code and which will cause erroneous failures when CFLAGS > contains things that are not valid in CXXFLAGS. doing a quick grep against > ld_compile, i see CFLAGS is explicitly specified in the call to ld_compile > by over half the tests which use this function ... and on my system, simply > removing the CFLAGS append inside of the ld_compile function doesnt cause > any regressions. > > so the question is, do we drop this auto CFLAGS append completely ? or do > we do a check against the suffix of $source and if it is set to .cc, auto > append CXXFLAGS rather than CFLAGS ? maybe something like the attached patch 2007-08-28 Mike Frysinger <vapier@gentoo.org> * lib/ld-lib.exp (default_ld_compile): Pull in global CXXFLAGS and add it to $flags when $source matches *.cc. (run_ld_link_exec_tests): Pull in global CXXFLAGS and execute CXX with CXXFLAGS when $lang matches c++. (run_cc_link_tests): Likewise. -mike
Attachment:
signature.asc
Description: This is a digitally signed message part.
2007-08-28 Mike Frysinger <vapier@gentoo.org> * lib/ld-lib.exp (default_ld_compile): Pull in global CXXFLAGS and add it to $flags when $source matches *.cc. (run_ld_link_exec_tests): Pull in global CXXFLAGS and execute CXX with CXXFLAGS when $lang matches c++. (run_cc_link_tests): Likewise. --- binutils-2.18/ld/testsuite/lib/ld-lib.exp +++ binutils-2.18/ld/testsuite/lib/ld-lib.exp @@ -206,6 +206,7 @@ # proc default_ld_compile { cc source object } { global CFLAGS + global CXXFLAGS global srcdir global subdir global host_triplet @@ -222,7 +223,11 @@ catch "exec rm -f $object" exec_output - set flags "-I$srcdir/$subdir $CFLAGS" + if {[string match "*.cc" $source]} then { + set flags "-I$srcdir/$subdir $CXXFLAGS" + } else { + set flags "-I$srcdir/$subdir $CFLAGS" + } # 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 @@ -1287,6 +1287,7 @@ global CC global CXX global CFLAGS + global CXXFLAGS global errcnt global exec_output @@ -1321,7 +1322,11 @@ # We ignore warnings since some compilers may generate # incorrect section attributes and the assembler will warn # them. - ld_compile "$CC -c $CFLAGS $cflags" $srcdir/$subdir/$src_file $objfile + if { [ string match "c++" $lang ] } { + ld_compile "$CXX -c $CXXFLAGS $cflags" $srcdir/$subdir/$src_file $objfile + } else { + ld_compile "$CC -c $CFLAGS $cflags" $srcdir/$subdir/$src_file $objfile + } # We have to use $CC to build PIE and shared library. if { [ string match "c" $lang ] } { @@ -1413,6 +1418,7 @@ global CC global CXX global CFLAGS + global CXXFLAGS foreach testitem $ldtests { set testname [lindex $testitem 0] @@ -1434,7 +1440,11 @@ # We ignore warnings since some compilers may generate # incorrect section attributes and the assembler will warn # them. - ld_compile "$CC -c $CFLAGS $cflags" $srcdir/$subdir/$src_file $objfile + if { [ string match "c++" $lang ] } { + ld_compile "$CXX -c $CXXFLAGS $cflags" $srcdir/$subdir/$src_file $objfile + } else { + ld_compile "$CC -c $CFLAGS $cflags" $srcdir/$subdir/$src_file $objfile + } } # Clear error and warning counts.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |