Clang LTO Support For The Linux Kernel Spun Up A Seventh Time
Written by Michael Larabel in Linux Kernel on 21 November 2020 at 03:30 AM EST. 8 Comments
LINUX KERNEL --
Google engineers have sent out their latest patches for allowing the mainline Linux kernel to be built with LLVM Clang link-time optimizations (LTO) for greater performance and possibly size benefits.

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.
Related News
About The Author
Author picture

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 or contacted via MichaelLarabel.com.

Popular News This Week