Linux 5.7 Makes It Very Easy To Build The Kernel With An LLVM-Based Toolchain
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.
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.
29 Comments