This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: PATCH RFA: Add --enable-build-with-cxx to gcc subdirectory


"Joseph S. Myers" <joseph@codesourcery.com> writes:

> On Sun, 21 Jun 2009, Ian Lance Taylor wrote:
>
>> +ifneq ($(ENABLE_BUILD_WITH_CXX),yes)
>>  COMPILER = $(CC)
>>  COMPILER_FLAGS = $(CFLAGS)
>>  LINKER = $(CC)
>>  LINKER_FLAGS = $(CFLAGS)
>> +else
>> +COMPILER = $(CXX)
>> +COMPILER_FLAGS = $(filter-out -fkeep-inline-functions,$(CXXFLAGS))
>> +LINKER = $(CXX)
>> +LINKER_FLAGS = $(filter-out -fkeep-inline-functions,$(CXXFLAGS))
>> +endif
>
> LINKER should only be $(CXX) if --with-host-libstdcxx is not given; for a 
> C++ build --with-host-libstdcxx is still useful for a non-bootstrapped 
> build to control how the host libstdc++ is linked in.

I think it would be a mistake to use --with-host-libstdcxx for stages
2 and 3 of a bootstrapped build.  I will try to figure out how to use
it for a non-bootstrapped build, or for stage 1 of a bootstrapped
build.  I admit there is room for argument here, so I would like to
hear the contrary case.


>>  # This is the variable to use when using $(LINKER).
>> +ifneq ($(ENABLE_BUILD_WITH_CXX),yes)
>>  ALL_LINKERFLAGS = $(ALL_CFLAGS)
>> +else
>> +ALL_LINKERFLAGS = --static-libstdc++ $(ALL_CXXFLAGS)
>> +endif
>
> I'd expect this to break if the host compiler does not support this 
> option, and so to need configure checks.

Actually, as with any unrecognized option beginning with two dashs, it
is ignored when linking.  However, I can add a configure check if you
think that would be better.  And actually I have yet to verify that it
works here, anyhow.

> And if --with-host-libstdcxx is 
> used that should override the use of this option.

But only for stage 1 or for a non-bootstrapped build.

> Will this link with static libgcc as well as static libstdc++ or is the 
> -static-libgcc option needed for that?  Shared libgcc has the same issues 
> as shared libstdc++ with a 4.5 compiler potentially generating calls to 
> functions not in an older system shared library, although to a lesser 
> extent than libstdc++; I'd say the default should be linking the compiler 
> with static libgcc, just as C programs are linked with static libgcc by 
> default.

I will add -static-libgcc as well.

Ian


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