Patches Posted For GCC LTO Optimizing The Linux Kernel
Since being merged in Linux 5.16, the Clang LTO support has continued in the Linux kernel just not in the name of performance but was also necessary for Clang-based CFI support with the kernel.
Going back a decade and long before Clang could build the mainline Linux kernel, there had been GCC LTO patches for the Linux kernel but ultimately never merged. Linus Torvalds expressed back then as well that he was unconvinced by LTO'ing the kernel. But now as we approach the end of 2022, there is a new attempt at GCC LTO support for the kernel.
Jiri Slaby of SUSE sent out this GCC LTO support patch series as a "first call for comments" and is based in part on prior patches by Andi Kleen as well as work from fellow SUSE engineer Martin Liska.
While compiler link-time optimizations in general are beneficial for performance due to being able to make optimizations when taking the whole program/code-base into account at the linking stage, in the case of the GCC LTO'ing of the Linux kernel at least with the latest tests carried out by the kernel developers they weren't able to record much difference.
Beyond negligible performance differences in their tests, they also found the LTO'ed kernel to be larger due to more inlining happening.
In any event for those interested in these latest patches to LTO the kernel with the GCC compiler, they can be found on the kernel mailing list.