Clang LTO PR Submitted For Linux 5.12, But x86_64 Support Not Included Yet
The pull request is pending that would allow Clang Link-Time Optimizations (LTO) to be enabled when building the Linux 5.12 kernel with this alternative compiler. The initial pull request has the compiler optimization work ready for the core infrastructure and 64-bit ARM (AArch64) while the x86_64 support isn't expected until the Linux 5.13 cycle.
Last month we outlined the Clang LTO ambitions for the mainline Linux kernel and it getting into position for 5.12. Clang Link Time Optimizations are being pursued for greater performance as well as being necessary for supporting Clang's Control-Flow Integrity (CFI) handling with the kernel.
Link-Time Optimizations allow for the compiler to carry out optimizations at link time on the entire program / binary rather than on a file-level basis. The Clang LTO support for the Linux kernel allows both full LTO as well as LLVM ThinLTO support.
In the past Linus Torvalds shot down GCC LTO efforts for the Linux kernel so there still isn't any mainlined GNU Compiler Collection support here. Google who has been pursuing these patches do stand good chances of getting this code merged for Linux 5.12 considering its well tested: the Android kernels for ~3 years now have not only been built by Clang but have also been making use of link-time optimizations. And besides performance, Clang LTO allows enabling CFI for greater security.
The only downside is that for Linux 5.12 the Clang LTO support would only be available for 64-bit ARM builds while the x86/x86_64 support isn't expected until Linux 5.13 due to work still pending on the objtool side.
The pull request adding Clang LTO for the Linux kernel can be found here while awaiting to see what Linus Torvalds thinks of the addition and if it will be pulled this cycle contrary to his prior LTO kernel comments.
Last month we outlined the Clang LTO ambitions for the mainline Linux kernel and it getting into position for 5.12. Clang Link Time Optimizations are being pursued for greater performance as well as being necessary for supporting Clang's Control-Flow Integrity (CFI) handling with the kernel.
Link-Time Optimizations allow for the compiler to carry out optimizations at link time on the entire program / binary rather than on a file-level basis. The Clang LTO support for the Linux kernel allows both full LTO as well as LLVM ThinLTO support.
In the past Linus Torvalds shot down GCC LTO efforts for the Linux kernel so there still isn't any mainlined GNU Compiler Collection support here. Google who has been pursuing these patches do stand good chances of getting this code merged for Linux 5.12 considering its well tested: the Android kernels for ~3 years now have not only been built by Clang but have also been making use of link-time optimizations. And besides performance, Clang LTO allows enabling CFI for greater security.
The only downside is that for Linux 5.12 the Clang LTO support would only be available for 64-bit ARM builds while the x86/x86_64 support isn't expected until Linux 5.13 due to work still pending on the objtool side.
The pull request adding Clang LTO for the Linux kernel can be found here while awaiting to see what Linus Torvalds thinks of the addition and if it will be pulled this cycle contrary to his prior LTO kernel comments.
2 Comments