Building The Linux Kernel With Clang Continues To Be Useful, New Features Pursued
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.