FreeBSD and LLVM

Ed Schouten ed at
Tue May 20 17:06:40 UTC 2008

Hello everyone,

First of all, for those of you who went to BSDCan, I hope you had a
pleasant flight/trip back home. :-)

On Saturday I went to the LLVM talk (see, which I
really enjoyed. On Friday Remko Lodder and I already talked with him
about the LLVM project. I was excited about the project, so I decided to
give it a try at the office.

At first I tried LLVM 2.2 with LLVM GCC4 4.2 from Ports, but it didn't
work like expected. I won't go into many details about it.

When I discussed the problems I was seeing on my system at the office,
someone pointed me to the beta tarballs of the upcoming version 2.3,
which I installed by patching our FreeBSD port.

As an ideal benchmark, I decided to compile an i386 kernel using the
LLVM 2.3 snapshot. I didn't expect it to happen, but it works! I was
capable of successfully booting into single user mode and shutting it
down safely. There is one problem however:

For some reason, the inline asm support of LLVM is incomplete and causes
compilation errors when generating some of the atomic functions in
i386/include/atomic.h (lines 262 to 265). To work around this, I made
the functions non-atomic. Silly, I know, but it was good enough to
perform some basic tests.

I think it would be nice if LLVM would once become our standard C
compiler. LLVM currently uses GCC as its frontend, which proves to be
somewhat compatible with the original GCC>

 Ed Schouten <ed at>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url :

More information about the freebsd-hackers mailing list