Ubuntu 21.04 To Turn On LTO Optimizations For Its Packages

Written by Michael Larabel in Ubuntu on 29 January 2021 at 08:00 AM EST. 22 Comments
On top of aiming to use Wayland by default, another high profile change being worked on for this spring's release of Ubuntu 21.04 is using link-time optimizations (LTO) for all 64-bit package builds.

Joining the likes of Fedora and openSUSE who have been enabling LTO optimizations by default for their package builds, Ubuntu developers are working to flip on link-time optimizations by default with their package builds. The plan is to have LTO enabled for all 64-bit package builds, namely for x86_64 and AArch64 as most notable, but the RISC-V 64-bit support won't see LTO at this point. POWER PPC64LE and s390x will also see LTO in addition to AArch64 and x86_64.

Link-time optimizations is about allowing for compiler optimizations at link-time on generally the entire program rather than just on a per-file/per-object basis. Link-time optimizations with this greater scope can pay off big time especially for larger code-bases. The optimizations at link-time tend to be beneficial for the resulting binary's program and in some case smaller file size, etc.

The downside to link-time optimizations are in some cases significantly longer compile times and can have an impact on memory use, but in this case it's just impacting the Ubuntu package build farm. Seeing Ubuntu 21.04 planning to LTO packages is terrific and great seeing more Linux distributions applying these compiler optimizations to all packages (granted, some exceptions like the GCC LTO support for the Linux kernel not being mainlined).

Matthias Klose sent out word that they are planning to enable link-time optimizations with Ubuntu 21.04 by default once the Glibc 2.33 C library is added to the release pocket. Upstream Debian meanwhile isn't planning on LTO-by-default for its packages until Debian 12 "Bookworm" and not the upcoming Debian 11.

The plans around Ubuntu flipping on LTO for package builds can be found via the Ubuntu Wiki. Great seeing this happening and will make Ubuntu 21.04 benchmarking even more fun coming up.
Related News
About The Author
Michael Larabel

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

Popular News This Week