Building The Linux Kernel With Clang Continues To Be Useful, New Features Pursued

Written by Michael Larabel in LLVM on 8 February 2021 at 02:12 PM EST. 16 Comments
LLVM
At last month's Linux.Conf.Au virtual conference was a presentation by Google engineer Nick Desaulniers on the current state of building the Linux kernel with LLVM Clang as an alternative to GCC.

Over the past year the "ClangBuiltLinux" effort has continued maturing with more Linux kernel code issues resolved to improve the portability across compilers. The industry interest has been around using Clang to build the Linux kernel for reasons including ensuring better code portability / testing, making use of various LLVM/Clang functionality not offered currently by GCC, some vendors using Clang as their preferred code compiler for licensing or other reasons, and in the case of Google they have already been using Clang to build their Linux kernel for a while and have been working to upstream more of the support.

As covered in other Phoronix articles, there has also been patchwork underway in supporting link-time optimizations (LTO) and profile guided optimizations (PGO) with Clang when building the Linux kernel. Other compiler features continue to be explored as well.

Some of the items that are set to be explored this year include more work on optimizing the Clang-built Linux build times, supporting more CPU architectures, and exploring other optimizations like using the Propeller optimizations. Using Clang to compile the Linux kernel may also become more important if/when the Linux kernel begins allowing optional Rust code within the tree.

See more details on building the Linux kernel with Clang via Nick Desaulniers' LCA2021 video embedded below and by visiting the GitHub project site for the effort.

Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week