Clang'ing The Kernel With Different LLVM Setups Will Be Easier With Linux 5.18
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.
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.
2 Comments