[LLVMdev] The LLVMLinux Project

Mark Charlebois charlebm at gmail.com
Fri Sep 7 15:13:24 PDT 2012

On Fri, Sep 7, 2012 at 10:03 AM, <llvmdev-request at cs.uiuc.edu> wrote:

> Message: 1
> Date: Thu, 06 Sep 2012 21:58:52 -0400
> From: Behan Webster <behanw at converseincode.com>
> To: "llvmdev at cs.uiuc.edu" <llvmdev at cs.uiuc.edu>
> Subject: [LLVMdev] The LLVMLinux Project
> Message-ID: <504954DC.3010708 at converseincode.com>
> Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"
> I'd like to announce the LLVMLinux project. This project aims to fully
> build the Linux kernel using Clang/LLVM on the various architectures
> supported by the Linux kernel. The project consolidates the work of the
> lll-project, the PAX team, and Mark Charlebois' work on the ARM kernel.
> http://llvm.linuxfoundation.org <http://llvm.linuxfoundation.org/>
> 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
> (Clang/LLVM and the Linux Kernel).
> Currently the work is centred around the ARM, x86 and x86_64
> architectures but contributions to support other architectures are
> welcome. Patches accepted!
> The Linux Kernel has some issues with being compiled with Clang; these
> are issues which the LLVMLinux project is attempting to fix in the Linux
> Kernel code base and pushed upstream:
> * The use of variable length arrays in structs (VLAIS)
> * Kbuild support for Clang (currently Kbuild is gcc specific)
> * Use of explicit register variables
> * Extra __refdata annotations needed to overcome segment reference errors
> * EXPORT_SYMBOL of inline functions
> However, there are some things in Clang/LLVM which also need to be
> addressed in order to make a Clang compiled Linux Kernel possible.
> Amongst other things these are:
> * The Linux kernel currently uses compiler flags which are unsupported
> in Clang:
>    * -fdelete-null-pointer-checks
>    * --fno-inline-functions-called-once
>    * --Wno-unused-but-set-variable vs --Wno-unused-variable (GCC 4.6)
>    * --mabi=aapcs-linux (Bug 11326)
> * Clang also reports errors for redefinitions of posix functions used in
> Linux kernel. It should be possible to suppress this.
> The LLVMLinux project is certainly following and hope to contribute to
> issues listed in the LLVM Meta bug 4068.
> But let me finish by thanking you all for the LLVM project and Clang
> toolchain. They are truly an awesome accomplishment.
> Behan
> --
> Behan Webster
> behanw at converseincode.com
Thanks Behan for the project summary.

I've been focused on building ARM Linux (versatile express) with Clang as
part of the LLVMLinux project.

There is only one remaining ARM specific issue with Clang/LLVM which if
fixed would allow an unmodified Clang/LLVM build to build the tip ARM Linux
kernel with a few Linux patches:

* ARM 64-bit type handling (ARM paired registers), namely Bug 11753

Other non-gating Clang/LLVM issues:

* Improved Clang IA support for ARM - to remove gas dependency
* Compiler-rt cross build for ARM which is needed for EABI builds (Bug

The --mabi=aapcs-linux (Bug 11326) issue listed above would be very nice to
have fixed as the only kernel workaround is to remove the flag.

The debug output from Clang is very helpful and I look forward to building
upstream Linux for ARM in the near future with upstream Clang/LLVM.

- Mark Charlebois
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120907/f8021c22/attachment.html>

More information about the llvm-dev mailing list