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
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