Fwd: enabling link time optimizations in package builds

Chris Lamb chris at reproducible-builds.org
Fri Jun 17 09:12:24 UTC 2022

Hi Roland,

> would enabling LTO cause reproducible issues?
> If I remember correctly, Bernhard mentioned some issues, which got 
> 'solved' by using less parallel builds (-j1 or -j4?).

Good question. There was definitely at least one LTO-related issue in the
past. Take, for instance, this bug report from 2015 about "FAT" LTO objects:


I don't know whether this is still valid and/or we would encounter it
with Doko's proposal, however.

// Chris

> -------- Forwarded Message --------
> Subject: enabling link time optimizations in package builds
> Resent-Date: Fri, 17 Jun 2022 08:28:51 +0000 (UTC)
> Resent-From: debian-devel at lists.debian.org
> Date: Fri, 17 Jun 2022 10:18:43 +0200
> From: Matthias Klose <doko at debian.org>
> To: debian-devel at lists.debian.org <debian-devel at lists.debian.org>
> CC: debian-ports at lists.debian.org <debian-ports at lists.debian.org>
> Link time optimizations are an optimization that helps with a single 
> digit percent number optimizing both for smaller size, and better speed. 
>   These optimizations are available for some time now in GCC.  Link time 
> optimizations are also at least turned on in other distros like Fedora, 
> OpenSuse (two years) and Ubuntu (one year).
> Details at https://wiki.debian.org/ToolChain/LTO
> The proposal is to turn on LTO by default on most 64bit release 
> architectures. Not proposing to do this on 32bit architectures because 
> of the limited address space at link time, and up to now nobody tested 
> LTO on 32bit archs.  In test rebuilds, there were 373 packages (dd-list 
> in the wiki page) found not to build with link time optimizations for 
> various reasons.  These range from easily fixable issues in symbols 
> files to some upstream issues.  The idea is to fix as many of these as 
> possible, and then change the packaging for the others to just turn off 
> LTO in the package build.
> To explicitly turn on LTO for a package build:
>    export DEB_BUILD_MAINT_OPTIONS=optimize=+lto
> to explicitly disable LTO:
>    export DEB_BUILD_MAINT_OPTIONS=optimize=-lto
> The idea is to file wishlist bug reports for those 373 packages and then 
> see how far we get, and if it's feasible to already turn on LTO for 
> bookworm.  If not, it should be turned on by default for the following 
> release.

More information about the rb-general mailing list