Bug 1988112

Summary: Enable LTO build of libtool for RHEL 9
Product: Red Hat Enterprise Linux 9 Reporter: Marek Polacek <mpolacek>
Component: libtoolAssignee: mkulik
Status: CLOSED ERRATA QA Contact: Martin Cermak <mcermak>
Severity: low Docs Contact:
Priority: low    
Version: 9.0CC: codonell, databases-maint, email, hhorak, jkejda, mcermak, praiskup
Target Milestone: rcKeywords: Bugfix, TestCaseNotNeeded, Triaged
Target Release: 9.0Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libtool-2.4.6-45.el9 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-17 13:48:10 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Marek Polacek 2021-07-29 19:24:21 UTC
This package opts out of LTO with this reasoning:    
    
    # The testsuite seems to not properly handle template instantiation and as
    # a result fails.  libtool itself appears to be OK from my by-hand testing.
    # Disable LTO until the testsuite issues are fixed
    %global _lto_cflags %{nil}

It would be nice to track the status of these failures and potentially re-enable LTO if/when possible.  To that effect, I'm opening this BZ.  If you decide that LTO is not worth the effort for this package, feel free to close as WONTFIX.

Thanks!

See also:
  https://issues.redhat.com/browse/RHELPLAN-54371
  https://issues.redhat.com/browse/RHELBU-522

Comment 1 Ondrej Dubaj 2021-08-18 06:26:46 UTC
The testsuite is still failing when LTO is enabled. I will try to talk to upstream about this issue.

Comment 2 Ondrej Dubaj 2021-08-18 10:26:11 UTC
Upsteam issue:

https://lists.gnu.org/archive/html/bug-libtool/2021-08/msg00001.html

Comment 3 Ondrej Dubaj 2021-09-16 09:52:25 UTC
No response from upstream yet.

Comment 4 mkulik 2021-11-02 22:01:41 UTC
Still no response from upstream. I decided to look into this. Here is short explanations for this issue:

LTO build seems to be completely fine, no problems during normal usage. We'll only see issues during test check, few testcases will fail when we try to build libtool with LTO, to be precise in these two:

67: Link order of deplibs                           FAILED (link-order2.at:125)
170: Run tests with low max_cmd_len                  FAILED (cmdline_wrap.at:47)

Number 170 is not a failure caused by LTO. This test is just a repetition of all other tests with changed max_cmd_len, any other test failure will cause test to fail too (most likely).
The only problem here is test number 67. Here is link to discussion of the origin for this test: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=391427
I didn't dig too deep into this but this failure is not related directly to LTO build of libtool. Here is what actually is causing this failure:

Compiler flags for this test (and most likely for rest of them) are inherited from actual build phase. (I'm not sure if this is expected but probably not)

Here is example of CFLAGS from current build process:
CFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS  -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC'

Flags responsible for LTO '-flto=auto -ffat-lto-objects' will be used in this test only when we specify them in build process. This test will always fail with those flags, regardless of LTO or not-LTO build.

TLDR: This issue is not related to libtool LTO build but to usage of LTO flags in testcases and/or correct handling them.

Comment 5 mkulik 2021-11-30 12:11:39 UTC
Build in testing in Fedora: https://bodhi.fedoraproject.org/updates/FEDORA-2021-6e9c836c28

It can be merge to RHEL9 at later date if there are no issues.

Comment 14 errata-xmlrpc 2022-05-17 13:48:10 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (new packages: libtool), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:2589