ld_compile: force CFLAGS really necessary ?

Nick Clifton nickc@redhat.com
Wed Aug 29 11:55:00 GMT 2007


Hi Mike,

>> 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 ?

I think the latter.

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

Nice, but I see one small niggle:

   * Not all C++ source files use the .cc file extension.  Earlier on in proc 
default_ld_compile there is code to determine if the compiler is gcc or g++, 
maybe you could tap into that ?  Of course you can then argue that we are not 
handling the case when the compiler is not gcc/g++.  I am not sure if this is a 
problem worth worrying about, but if it is we could always generate another 
patch to add an optional fourth parameter to default_ld_compile which specifies 
the language being compiled.

Cheers
   Nick



More information about the Binutils mailing list