- 1 LLVMLinux Project Overview
- 2 Show me the code!
- 3 Current Patch Statistics
- 4 News
- 5 Why use Clang/LLVM with the Linux Kernel?
- 6 Project Status
- 7 How Can I Get Involved?
- 8 Who Else is Using Clang/LLVM?
LLVMLinux Project Overview
This project aims to fully build the Linux kernel using Clang which is the C front end for the LLVM compiler infrastructure project. Together Clang and LLVM have many positive attributes and features which many developers and system integrators would like to take advantage of when developing and deploying the Linux Kernel as a part of their own projects.
The hope is that this project will help reduce duplicate work, as well as concentrate, and accelerate efforts around this subject matter in order to allow Linux Kernel developers, and system integrators to have the choice of a Clang compiled Linux kernel. The goal is for this project to be a testing/proving ground for these updates and to get patches that make this possible upstream to their respective projects.
The LLVMLinux project consolidates the work of the lll-project, the PAX team, and Mark Charlebois' work on the ARM kernel.
There have been several presentations and articles on this topic if you wish to learn more about the reasons for this project.
Currently the work is centred around the ARM, x86 and x86_64 architectures but contributions to support other architectures are welcome. Patches accepted!
Interested parties will be holding a Bi-weekly Google Hangout to discuss project status and goals.
Show me the code!
By popular demand, here are the coles-notes version of how to build a kernel with clang.
- Get the latest SVN version of clang (v3.5 or higher: You need named register support which isn't in v3.4)
- Patch your kernel source (not all required patches are upstream yet)
- aarch64, arm, x86_64, all
- Alternatively you can use the LLVMLinux kernel tree (recent mainline with latest LLVMLinux patches applied)
- Build your kernel, making sure to set HOSTCC/CC and optionally ARCH/CROSS_COMPILE.
- For native compiling (like for x86_64): make HOSTCC=clang CC=clang
- For cross: make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- HOSTCC=clang CC=clang
- For cross: make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- HOSTCC=clang CC=clang
- You may find you need to set GCC_TOOLCHAIN=<path-to-your-gcc-cross-toolchain> if the above doesn't work.
Yes, there is still a dependancy on parts of the gcc toolchain. Most notably ld, as, and sometimes libgcc.
Current Patch Statistics
2014-10-20 Number of patches: 46 all: 26 submitted: 8 acked: 3 accepted: 2 aarch64: 3 submitted: 0 acked: 0 accepted: 0 arm: 15 submitted: 11 acked: 7 accepted: 1 x86: 2 submitted: 0 acked: 0 accepted: 0 totals: 46 submitted: 19 acked: 10 accepted: 3 completed or obsoleted: 116
2014.04.07 Jan-Simon Möller will be giving a talk during EuroLLVM in Edinburgh. See the programme page.
2014.02.02 A patchset for the stable kernel will be available for kernel v3.13 soon.
2014.02.01 Jan-Simon will be giving talks during FOSDEM. Join us in the LLVM devroom !
2013.09.18 Behan and Mark will be leading the LLVM microConference at Linux Plumbers Conference.
2013.02.02: Jan-Simon Möller will be presenting a lightning talk at FOSDEM: The Linux Kernel with Dragon Wings
2012.08.16: An LLVM micro-conference has been added to this year's Linux Plumbers Conference. Mark Charlebois and Behan Webster will talking about LLVM Toolchain - Update and State of Building Linux with LLVM and Jan-Simon Moeller will be talking about LLVM/Clang x86 Kernel Build.
2012.07.14 Demo of a clang built kernel running on an i7 laptop!
Why use Clang/LLVM with the Linux Kernel?
- Fast Compiles (making you able to work faster)
- LLVM/Clang is a fast moving project with many things fixed quickly and features added.
- LLVM is a family of tools used in many problem domains leading to one code base being able to build tools to work on just about anything you need: one place to add features, or fix bugs.
- BSD License (some people prefer this license to the GPL)
- Built in static analyzer
- Great error reporting and Fix-it hints
- LLVM technology can be embedded into many tools (even yours!)
- Already in wide used in OSS projects and in industry
Project Bug Status
Current State of the LLVMLinux project
- A build framework which downloads and builds LLVM, Clang, QEMU, and cross-compiles the linux kernel, and LTP
- Work is currently centering around the ARM, i586 and x86_64 architectures (it would be great to see contributions to other architectures such as MIPS, PowerPC, etc)
- The x86_64 patches from the lll-project have been rolled into the LLVMLinux code base. The targets for i586 and x86_64 allow you to build working kernels. However, not for production use yet.
- An SD image has been constructed using Linaro upon which we add the latest Linux Test Project (LTP) for testing ARM targets in QEMU. In future we hope to extend this testing to other architectures as well.
- Built kernel are booted using QEMU with the aforementioned SD image, which executes the LTP in an effort to see whether the kernel has been compiled properly with Clang/LLVM.
- Buildbot boot-tests patched ARM kernels compiled with both Clang and gcc, as well as nightly LTP runs on both kernels.
- The above process is executed by buildbot, which provides continuous integration for all the associated code bases, and posts build statuses to the #llvmlinux IRC channel on OFTC
- Any issues which are found through these processes will be fixed, and patches submitted upstream to the kernel and LLVM/Clang projects.
- A list of broken kernel options can be found here.
How Can I Get Involved?
- Hack the code! Fix some Bugs! Work on missing features from the Roadmap!
- Join the Mailing list, read/update the FAQ, discuss on IRC: #llvmlinux on OFTC (IRC logs)
- Watch the results of the automated build and test server which posts status to the IRC channel