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] Fix PR38862 (bootstrap failure graphite vs. static linking)


On Sat, 17 Jan 2009, Ian Lance Taylor wrote:

> "Dave Korn" <dave.korn.cygwin@googlemail.com> writes:
> 
> >   Got any thoughts on how to go about linking cc1 (and friends) against
> > -lstdc++ during bootstrap? ;-)
> 
> One issue is the handling of stage 1.  Until we convert gcc to be
> written in C++, we are not going to want to require a C++ compiler in
> order to build gcc.  Therefore, until that is done, we would need a
> four stage bootstrap.  The first stage would build without requiring

No, you simply need to link with the libstdc++ that was used when building 
PPL (which would have needed a C++ compiler to build).

If that is static (as here) then there are no problems using the new 
compiler.  If it has the same SONAME as the newly built libstdc++ then the 
binaries should work when run with the new libstdc++.  And if it has a 
different SONAME, it's necessary to use the old library not the new one, 
unless you include PPL in the bootstrap process, as the PPL binaries won't 
be compatible with the new one.  (If GCC becomes written in C++ and PPL 
becomes required, it will be necessary to be able to incorporate PPL 
smoothly in the bootstrap process to handle SONAME transitions.)

Similarly, the issue applies when building cross compilers, when exactly 
one libstdc++ is relevant: that used to build PPL.

> Presumably enabling a four stage bootstrap would just mean hacking up
> Makefile.def and Makefile.tpl some more.  Then we could just link
> explicitly against the libstdc++ in the previous stage.  In general I

Additional work (depending on the host) would be needed to ensure the new 
libstdc++ is found when the new compiler binaries are executed in 
subsequent bootstrap stages, if they are dynamically linked with it.  
(libtool relinks at install time on some platforms to deal with such 
problems.)

> think it will work to simply add -lstdc++ and perhaps -lm; I don't
> think it would be necessary to actually do the link with the g++
> driver.

With the option to use -Wl,-Bstatic,-lstdc++,-Bdynamic to create a binary 
not depending on a particular shared libstdc++.  (As not all linkers 
handle those options, perhaps a --with-host-libstdc++ or similar configure 
option would be best for the general case.)

-- 
Joseph S. Myers
joseph@codesourcery.com


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