Google Posts Patches So The Linux Kernel Can Be LTO-Optimized By Clang

Written by Michael Larabel in Linux Kernel on 24 June 2020 at 05:35 PM EDT. 43 Comments
A Google engineer has posted patches for review so that the mainline Linux kernel can be built with Link-Time Optimizations (LTO) by the LLVM Clang code compiler.

Years ago Intel developers had sent out patches for LTO support for the Linux kernel but Linus Torvalds was ultimately unconvinced by it. That was back in 2014 when trying to squeeze more performance out of the Linux kernel. LTO patches for the Linux kernel are brought up every so often but at last check still no material progress in getting it mainlined.

Link-time optimizations allow for broader optimizations thanks to them being applied during the linking process rather than just optimizing individual object files. LTO is known for helping with execution speed thanks to being able to capture more aggressive optimizations and also helping in reducing code size by a measurable amount.

With this new patch series, Google's Sami Tolvanen sent out LTO kernel patches but this time for wiring it up for the LLVM Clang compiler rather than GCC.

In addition to the performance focus of LTO, the other motive for Google LTO'ing the kernel is for enabling Clang Control-Flow Integrity (CFI) in conjunction with LTO. Google has already been using LTO+CFI-enabled Linux kernel builds for their Google Pixel devices for two years. Given this Clang LTO+CFI enablement is already being used at scale in the many production devices from Google, this does stand better chances we could see this LTO functionality mainlined as likely by now any nasty issues would have already been crossed.

This patch series can be found on the kernel mailing list. No performance numbers were shared for a Clang LTO'ed Linux kernel but I will run some Phoronix benchmarks if it looks like these patches are going to get pulled for mainline.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of 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 automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via

Popular News This Week