LWN.net Logo

Converting GCC to C++

Converting GCC to C++

Posted Jun 18, 2008 21:56 UTC (Wed) by linuxrocks123 (guest, #34648)
In reply to: Converting GCC to C++ by madscientist
Parent article: Converting GCC to C++

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.


(Log in to post comments)

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.

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