Compile FreeBSD kernel with gcc48

Dimitry Andric dim at
Sun Nov 11 12:27:36 UTC 2012

On 2012-11-11 10:59, Alie Tan wrote:
> Anyone have experience compiling FreeBSD kernel with gcc48
> I have tried it but no success with this in src.conf
> C= /usr/local/bin/gcc48
> CXX= /usr/local/bin/g++48
> CWARNFLAGS= -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes
> \-Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual
> \-Wno-pointer-sign -D__FreeBSD_cc_version=0 \-Wno-unused-function
> -Wno-inline -Wno-format \-Wno-uninitialized -Wno-array-bounds
> -Wno-missing-prototypes

Last time I tried, I could get it to build with a gcc 4.8 snapshot, but
it failed to boot.  I did not investigate a great deal, but it looked a
lot like some sort of optimization bug.  Note that gcc 4.8 is still
experimental, so problems like this can be expected.

However, with gcc 4.7.1, which is a released version, the kernel did
build, and even boot.  With that kernel booted, I timed how long a "make
-j8 buildworld" took, compared to booting with kernels compiled by gcc
in base (v4.2.1) and clang in base (v3.2), on different optimization
settings.  The raw results are here:

- Kernels compiled with clang 3.2 at -O2 are ~8% faster in system time
   than kernels compiled with gcc 4.2.1 at -O2.
- Kernels compiled with clang 3.2 at -O2 perform equally to kernels
   compiled with gcc 4.7 at -O2, there is no significant difference.
- Kernels compiled with gcc 4.7 at -O3 have a slight advantage in system
   time (~3.6%) against kernels compiled with clang 3.2 at -O2.
(I did not test a kernel compiled with clang 3.2 at -O3.)

> Another question, is there any benchmark for LLVM/Clang vs gcc45, gcc46,
> gcc47 or gcc48?

As said, I only tested clang 3.2 against gcc 4.2 from base, and gcc
4.7.1 (hand-built, since the version from ports is inexplicably some
random snapshot, not a released version).

If anybody is extremely interested in more results, they should sponsor
some fast hardware, and donate it to the FreeBSD Project. ;-)

More information about the freebsd-current mailing list