BSDCan2010 - Final Release

BSDCan 2010
The Technical BSD Conference

Roman Divácký
Day Talks - 1 - 2010-05-13
Room DMS 1160
Start time 11:00
Duration 01:00
ID 175
Event type Lecture
Track Hacking
Language used for presentation English


Replacing gcc with clang as the FreeBSD system compiler

FreeBSD currently uses gcc as its system compiler. Because of a political decision on GPLv3 we are stuck with version 4.2.1. Recently a new possible candidate for system compiler arised - clang (based on LLVM). We are currently maintaining a branch of FreeBSD that uses clang as the system compiler for C/ObjC/C++. The talk aims to describe the history, current status and future possibilities of clang in FreeBSD as presented in the clangbsd branch.

The system compiler is integral and absolutely necessary part of the FreeBSD operating system. We have used gcc for almost the whole life of FreeBSD. It supports all of the architectures we need, it provides some tweaks we added over the time and generally serves us quite well. Unfortunatelly gcc switched to GPLv3 which is incompatible with FreeBSD, as decided by core, thus we are stuck with quite old gcc version 4.2.1. There are other problems with gcc, mostly awkward dealing with upstream. A very similar story goes on with the assembler and linker.

At first a students project that grew into industry supported solution, mostly backed by Apple, the LLVM emerged. One of the LLVM's subprojects is a C/ObjC/C++ compiler. The whole package of LLVM+clang reached the state when it can compile basically all of FreeBSD and a branch of FreeBSD integrating clang into it was established and is being maintained. The other interesting LLVM subproject is llvm-mc, the assembler and dissasembler based on LLVM. There's also compiler-rt, a possible replacement for libgcc.

This talk aims to introduce you to the current state of clang/llvm on FreeBSD, what it can do, what are the advantages over gcc and what are the last missing pieces. At last I'd like to discuss the possibility of integrating clang into FreeBSD as the system compiler.