LWN.net Logo

Converting GCC to C++

Converting GCC to C++

Posted Jun 18, 2008 17:20 UTC (Wed) by madscientist (subscriber, #16861)
Parent article: Converting GCC to C++

I don't have a problem with this as a concept, but IMO Ian doesn't fully confront the most
difficult issue (IMO): bootstrapping.  Although I can see where it's painful for the GCC
maintainers, it's very, very nice to not need anything fancier than a simple C compiler in
order to build GCC itself.

On the other hand, maybe this effort will convince the GCC folks to come to grips with
cross-compiled/encapsulated C++ and the issues it has (just for example, we have a
-static-libgcc flag, but no -static-libstdc++ ...)


(Log in to post comments)

Converting GCC to C++

Posted Jun 18, 2008 21:56 UTC (Wed) by linuxrocks123 (guest, #34648) [Link]

If my understanding is correct, GCC uses GCC language extensions all over the place anyway,
and doesn't support being bootstrapped by anything other than GCC itself.  Therefore, I don't
think they'd be losing much portability with regard to bootstrapping; they're not portable as
it is.

Converting GCC to C++

Posted Jun 18, 2008 22:11 UTC (Wed) by madscientist (subscriber, #16861) [Link]

I don't believe this is true.  Or rather, the build for GCC today builds a version of the C
compiler only, called "xgcc", and that bootstrapping compiler is used to build all the other
compilers in the collection (including the final "gcc" C compiler).

However, as far as I'm aware you do NOT need GCC to build the bootstrapping compiler.

It appears that this proposal would change the bootstrapping compiler to be C++ (xg++ or
similar) instead of C--and that implies a LOT more about the properties of the host system.
Either you have to have a very capable C++ compiler already installed on the system, or you
have to restrict your use of C++ in at least the bootstrapping section of GCC to a generic
subset.

Even though Ian says he wants to use a sensible subset of C++, the kinds of things he wants to
use (templates for example) are the kinds of things that have only relatively recently been
implemented in a sane manner among a majority of compilers.

I guess the "initial bringup" could be something like, build GCC 4.3 (or whatever the last
version written in C was) for your target, then use that to build GCC 5.0 written in C++.
Once you have that you can use it to build subsequent versions.  Annoying but you only have to
do it once.  That restricts you to using whatever C++ support appears in GCC 4.3 (or whatever)
but that seems like it should be pretty safe.

Still, I think there's more trouble here than Ian's slides indicate.

Converting GCC to C++

Posted Jun 18, 2008 22:19 UTC (Wed) by stevenb (guest, #11536) [Link]

Bootstrapping is *by* *definition* a compiler compiling itself.  But the first step (in this
case: building a gcc to build gcc, the so-called stage0 compiler) can be done with any ISO C90
compiler.  So bootstrapping really doesn't limit portability.

Converting GCC to C++

Posted Jun 19, 2008 0:38 UTC (Thu) by gdt (subscriber, #6284) [Link]

I don't have a problem with this as a concept, but IMO Ian doesn't fully confront the most difficult issue (IMO): bootstrapping.

If it is such a difficult problem then I suppose a side-effect of the proposal will be to change the strategy for bringing up GCC on a new platform from bootstrapping to cross-compiling.

Converting GCC to C++

Posted Jun 19, 2008 1:32 UTC (Thu) by vomlehn (subscriber, #45588) [Link]

It could be a good thing if the strategy changes from bootstrapping to cross-compiling, as it
implies more use of cross-compiling. Such a change seems likely to drive improvements to
cross-compiling, a subject near and dear to many in the embedded world.

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds