LWN.net Logo

Converting GCC to C++

Converting GCC to C++

Posted Jun 18, 2008 22:11 UTC (Wed) by madscientist (subscriber, #16861)
In reply to: Converting GCC to C++ by linuxrocks123
Parent article: Converting GCC to C++

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.


(Log in to post comments)

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