Linux 5.7 Makes It Very Easy To Build The Kernel With An LLVM-Based Toolchain

Written by Michael Larabel in LLVM on 12 April 2020 at 07:15 AM EDT. 29 Comments
LLVM
Since last year it's been possible to build a mainline x86_64 Linux kernel with a mainline LLVM Clang compiler while for the in-development Linux 5.7 kernel are more improvements on the LLVM front.

Kbuild updates for the Linux 5.7 kernel now has a single switch of LLVM=1 that when enabled will have the kernel use Clang and all LLVM utilities in place of GCC and Binutils.

LLVM=1 can be passed from the command-line or as an environment variable and when building the kernel will then prefer the LLVM toolchain components found in your PATH. The one exception is that the LLVM assembler will not be used by default as the kernel still has a few issues there. The Kbuild updates for Linux 5.7 though also include LLVM_IAS=1 for enabling the integrated assembler, which is considered experimental.

Long story short, with the merged Kbuild updates on Linux 5.7 setting LLVM=1 now makes it very easy to transition over to using an LLVM-based toolchain for building the kernel.
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