Clang'ing The Kernel With Different LLVM Setups Will Be Easier With Linux 5.18

Written by Michael Larabel in LLVM on 3 April 2022 at 05:26 AM EDT. 2 Comments
LLVM
Building the Linux kernel with LLVM/Clang rather than GCC has continued maturing nicely since the support was mainlined two years ago and additional LLVM/Clang functionality continues to be optionally supported by the Linux kernel. With Linux 5.18 there is an improvement around the handling of the LLVM environment variable for dealing with versioned compiler binaries or compiler installations outside of the PATH.

LLVM=1 is used for currently defining the LLVM/Clang tool variables for building the Linux kernel with this non-GNU toolchain. But currently if wanting to make use of an LLVM/Clang installation outside of the PATH or like on Debian/Ubuntu and other distributions where the Clang binaries are version postfixed, it's not trivial.

With the changes that landed in Linux 5.18, LLVM=-14 can now be specified if say wanting to target LLVM/Clang 14 binaries of the system in the PATH. Or if wanting to target a compiler installation outside of PATH, LLVM=/path/to-llvmcan be set. Otherwise the existing LLVM=1 behavior remains the same as on previous kernels.

More details on this more flexible LLVM handling for Linux 5.18 via this commit.
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