Bug 1789137 - Flags injection for building packages with LTO by default
Summary: Flags injection for building packages with LTO by default
Alias: None
Product: Fedora
Classification: Fedora
Component: redhat-rpm-config
Version: 32
Hardware: All
OS: All
Target Milestone: ---
Assignee: Florian Festi
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2020-01-08 20:16 UTC by Jeff Law
Modified: 2021-05-25 18:01 UTC (History)
12 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2021-05-25 18:01:33 UTC
Type: Bug

Attachments (Terms of Use)
Changes to redhat-rpm-config to inject LTO flags (1.56 KB, patch)
2020-01-08 20:16 UTC, Jeff Law
no flags Details | Diff

Description Jeff Law 2020-01-08 20:16:44 UTC
Created attachment 1650815 [details]
Changes to redhat-rpm-config to inject LTO flags

Description of problem:
We have an in-progress Fedora change request to enable LTO by default for Fedora 32.  We want the change to apply to packages built with rpmbuild and which honor the flags injection mechanism used by redhat-rpm-config.


We know there are some packages that are not going to work with LTO as they use features which are currently incompatible with LTO -- for example top level ASM statements to implement function versioning.  So we also want to make it easy for packages to opt-out of LTO.  Ideally a single line in their .spec file should be sufficient.

openSUSE uses %{_lto_cflags} to pass in flags for LTO builds.  I see absolutely no reason to use a different name.  It's given a default value in their equivalent of redhat-rpm-config.

Packages that want to opt-out use this in their .spec file:

%define _lto_cflags %{nil}

openUSE also uses the following for packages that need an additional option for handling of archive libraries:

%global _lto_cflags %{?_lto_cflags} -ffat-lto-objects

I'm not a big fan of their opt-out and archive library handling as they encourage package maintainers to directly manipulate the compiler flags.  I would have instead had a macro which indicated the package didn't want LTO (or needed special archive library handling) and hid the flags manipulation in redhat-rpm-config.  But given openSUSE was the first mover here, I'll put my objection to their approach aside and recommend doing the same for Fedora.

Note that we're using -ffat-lto-objects and -flto-partition=one in the base LTO flags right now.  That allows us to focus on more important issues in the immediate term.  Those options will be pushed down into each package that needs them to improve build-times with LTO.  I'd like pre-approval to drop those from _lto_cflags once I've identified and fixed the packages that need that special archive handling.

From a deployment standpoint I think we should land the flags injection enablement for redhat-rpm-config at the same time as the sed hacks to fix broken configure scripts and that both should land immediately after Jakub drops in gcc-10 into rawhide.

So the immediate goal is to get agreement on the flags injection patch, but not install it just yet.  Assuming we can reach agreement on the flags injection and configure script fixes, I'm happy to own committing the bits just after Jakub drops in gcc-10 to rawhide.

pull-request will be submitted shortly.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:

Actual results:

Expected results:

Additional info:

Comment 1 Ben Cotton 2020-02-11 17:36:55 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 32 development cycle.
Changing version to 32.

Comment 2 Michael Catanzaro 2020-07-07 12:41:12 UTC
Can this be closed?

Comment 3 Jeff Law 2020-07-08 22:07:44 UTC
Not yet.  We need the opt-outs in place first.  I've been dropping those in on/off the last couple weeks and expect to wrap that up this week (there's ~200 of them across F33 and I'm trying to make sure we document each reasonably well in the affected .spec file, so it takes time).  Once the opt-outs in place we'll look to push the actual LTO enablement in redhat-rpm-config.

Comment 4 Michael J Gruber 2020-07-31 16:14:05 UTC
So, is LTO in place but no opt-out? A couple of build failures in rawhide seem to indicate that but I might be wrong.


Comment 5 Michael Catanzaro 2020-07-31 16:40:10 UTC
To opt out:

%define _lto_cflags %{nil}

Comment 6 Fedora Program Management 2021-04-29 17:12:49 UTC
This message is a reminder that Fedora 32 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 32 on 2021-05-25.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '32'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 32 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 7 Ben Cotton 2021-05-25 18:01:33 UTC
Fedora 32 changed to end-of-life (EOL) status on 2021-05-25. Fedora 32 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.