building gcc with clang/llvm

Has anybody tried building gcc using clang/llvm as the first stage compiler?



On FreeBSD we build gcc 4.2 with clang when clang is the system
compiler. The build process differs from the normal gcc build process
so the final gcc is built directly with clang. We do compile gcc
without -Werror because clang generates a lot of warnings (presumably a
modern gcc would as well).

--- Brooks

I tried this and it seems to work.


export CC=<bin for clang>

and then when you run configure for gcc, it will use clang for the first stage.

There were some warnings but the results several phase bootstrapped gcc seemed to work.

Works fine with

Ubuntu clang version 3.0-6ubuntu3 (tags/RELEASE_30/final) (based on LLVM 3.0)
Target: x86_64-pc-linux-gnu
Thread model: posix

Build with:

$ CXX=clang++ CC=clang ../src/configure
$ make -j