Clang LTO Support For The Linux Kernel Spun Up A Seventh Time
Google's team has done a good job not only working on the mainline Clang support for the Linux kernel across the likes of AArch64 and x86_64, but also with other related features of interest to them like the Clang LTO abilities to which internally they already leverage extensively. This upstreaming work has been ongoing for many months.
Aside from the performance benefits, Clang link-time optimizations for the kernel are also needed for allowing Clang Control-Flow Integrity (CFI) to be used. Google notes they have used a Clang LTO+CFI build for their Linux kernel on "millions of Pixel devices" with Android since 2018.
The changes needed to the mainline kernel tree are mostly build system alterations and LLVM bitcode vs. ELF handling differences.
With the v7 patches sent out this week the 64-bit ARM support has been restored while the x86_64 support for Clang LTO has been temporarily dropped. Some objtool fixes are needed now on the x86_64 side and that work is pending. Hopefully it won't be much longer before this work is merged and will certainly be interesting to benchmark a Clang LTO'ed Linux kernel on the desktop.