User Tools

Site Tools


llvmlinux

This is an old revision of the document!


LLVMLinux

:!: This project is not currently active. This information is kept available of archive purposes.

The LLVMLinux project aims to fully build the Linux kernel using LLVM/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 LLVMLinux project consolidates work from the lll-project, the PAX team, and Mark Charlebois' work on the ARM kernel.

Show me the code!

By popular demand, here are the coles-notes version of how to build a kernel with clang.

  1. Get the latest SVN version of clang (v3.5 or higher: You need named register support which isn't in v3.4)
  2. You can use the LLVMLinux kernel tree (recent mainline with latest LLVMLinux patches applied)
    • git clone git://git.linuxfoundation.org/llvmlinux/kernel.git
  3. 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.

News

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.20 Behan Webster will be presenting a talk at Embedded Linux Conference: LLVMLinux: Compiling the Linux Kernel with LLVM slides Video

2013.02.18: Behan Webster will be presenting a talk at Android Builders Summit: LLVMLinux: Compiling Android with LLVM slides

2013.02.02: Jan-Simon Möller will be presenting a lightning talk at FOSDEM: The Linux Kernel with Dragon Wings

2012.08.16: Bryce Adelstein-Lelbach will be giving a talk on LLVM-compiled Linux for the Real World at LinuxCon NA

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.08.13: A LLVM microconference has been setup for this year's Linux Plumbers Conference. Several project contributors will be giving talks during the microconference.

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

Who Else is Using Clang/LLVM?

llvmlinux.1512425162.txt.gz · Last modified: 2017/12/04 22:06 by emsearcy