Compile FreeBSD kernel with gcc48

Alie Tan alie at
Thu Nov 15 02:46:07 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
> > NO_WERROR= 1
> 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:
> Summary:
> - 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. ;-)

No idea why since there is no compilation error. It stops at this point:

/usr/local/bin/gcc48  -O2 -pipe  -O3 -fno-strict-aliasing -pipe
-funroll-loops -I/usr/src/lib/libc/include
-I/usr/src/lib/libc/../../include -I/usr/src/lib/libc/amd64 -DNLS
-D__DBINTERFACE_PRIVATE -I/usr/src/lib/libc/../../contrib/gdtoa -DINET6
-I/usr/obj/usr/src/lib/libc -I/usr/src/lib/libc/resolv -D_ACL_PRIVATE
-DPOSIX_MISTAKE -I/usr/src/lib/libc/../../contrib/tzcode/stdtime
-I/usr/src/lib/libc/stdtime -I/usr/src/lib/libc/locale -DBROKEN_DES
-DSYMBOL_VERSIONING -std=gnu99 -fstack-protector -Wall -Wredundant-decls
-Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
-Winline -Wcast-qual -Wno-pointer-sign -D__FreeBSD_cc_version=800001
-Wno-unused-function -Wno-inline -Wsystem-headers -Wall -Wno-format-y2k
-Wno-uninitialized -Wno-pointer-sign -c nslexer.c -o nslexer.o
In file included from /usr/src/lib/libc/net/nslexer.l:49:0:
/usr/src/lib/libc/../../include/nsswitch.h:236:14: warning: redundant
redeclaration of '_nsyylineno' [-Wredundant-decls]
 extern int   _nsyylineno;

And waited for couple of hours still hanging at that point with gcc48

Alie T

More information about the freebsd-current mailing list