turning on link time optimizations (LTO) for 21.04

Matthias Klose doko at ubuntu.com
Fri Jan 29 12:34:27 UTC 2021


Link time optimization (LTO) is a way to run optimizations across multiple
translation units, enabling more opportunities for optimizations at link time.
The optimizations allow for faster code and smaller files.

LTO will be turned on for the 64bit architectures (except riscv64) by default
for 21.04, after glibc 2.33 made it to the release pocket (just for
disentanglement).

Some upstream projects already turn on LTO by default, or provide configuration
options to turn it on (like GCC, Python).  Other Linux distributions are already
released with LTO turned on by default.

If you want to test a package build with LTO turned on, use

    DEB_BUILD_OPTIONS=optimize=+lto dpkg-buildpackage ...

using dpkg 1.20.7.1ubuntu2, currently in hirsute-proposed.

Please make sure to add the 'lto' tag to bug reports when reporting issues about
LTO.

Details at https://wiki.ubuntu.com/ToolChain/LTO.
Feedback and improvements for the wiki page are welcome.

Matthias




More information about the ubuntu-devel mailing list