Building the kernel and userland with llvm/clang

David Wolfskill david at
Tue Aug 28 17:13:13 UTC 2012

On Tue, Aug 28, 2012 at 05:53:15PM +0100, Jamie Paul Griffin wrote:
> ...
> Thanks David, that's helpful information.

Good; that was the intent. :-)

> I'll likely give it a go. So does clang create better binaries and libraries, in terms of performance and such-like? I'm currently reading as much as I can find about clang and its associated tools; however, compilers are quite complex software and learning about them is, for me at least, a lot to take in. 
> ....

I don't know that it creates "better" code, but I believe that at least
some of its error/warning checking may be a bit better: it certainly
whines about a fair bit of GNUish code, citing (e.g.) "Tautological
compares" ... and that sort of thing seems as if it's something I'd want
to know about if it were my code, so I could fix it.

From the time (a few weeks) when I was building stable/9 with both gcc &
clang (on different slices, sources updated to the same GRN), I got the
impression that clang was slower (to compile) than gcc was.

I note that I've had no issues at all with interoperation of executables
& libraries built with gcc & clang.  I consider this a Good Thing.  :-)

As I understand the issues, FreeBSD uses a (somewhat modified) version
of the last GPLv2-licensed version of gcc, and there is strong incentive
to avoid "tainting" FreeBSD with a GPLv3-licensed version of gcc.

Thus, if we want to be able to move forward with our "system compiler,"
we have little choice but to use something other than gcc.  clang
appears to work, so I plan to exercise it & report issues if I encounter

David H. Wolfskill				david at
Depriving a girl or boy of an opportunity for education is evil.

See for my public key.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url :

More information about the freebsd-stable mailing list