Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1986172

Summary: Enable LTO build of mariadb for RHEL 9
Product: Red Hat Enterprise Linux 9 Reporter: Dave Malcolm <dmalcolm>
Component: mariadbAssignee: Michal Schorm <mschorm>
Status: CLOSED ERRATA QA Contact: Jakub Heger <jheger>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.0CC: databases-maint, hhorak, jheger, ljavorsk, mpolacek, mschorm, zmiklank
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: mariadb-10.5.13-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-17 12:42:41 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:
Bug Depends On: 1994993    
Bug Blocks:    

Description Dave Malcolm 2021-07-26 20:04:07 UTC
mariadb.spec in RHEL:
  http://pkgs.devel.redhat.com/cgit/rpms/mariadb/tree/mariadb.spec?h=rhel-9.0.0-beta
currently disables LTO, with this message in %build:
    # This package has static probe points which do not currently
    # work with LTO and result in undefined symbols at link time.
    # This is being worked on in upstream GCC
    %define _lto_cflags %{nil}

This was added to Fedora's mariadb.spec by Jeff Law on 2020-08-05 in https://src.fedoraproject.org/rpms/mariadb/c/cdfc0ff97706d24ab636f0962a205bfba93d6771 (3:10.4.13-6)

Although the message says "This is being worked on in upstream GCC", I work on upstream GCC and I wasn't able to find a bug report about this in the upstream tracker (Jeff is no longer at Red Hat).

It would be good to re-enable LTO for mariadb in Fedora, CentOS stream, and RHEL 9, so that it can benefit from LTO (smaller/faster binaries, deeper analysis for compiler warnings, etc).  

Please try removing the
   %global _lto_cflags %{nil}
from the specfile.

If you still run into issues, please let me know via this bug so that the toolchain team can fix things appropriately.

Thanks!

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

Comment 1 Michal Schorm 2021-07-27 10:10:22 UTC
The LTO for MariaDB currently seems broken:
  https://jira.mariadb.org/browse/MDEV-25633

Though, we should verify whether Fedora build would suffer of the same issue as the Debian build described in the upstream issue.

Comment 2 Michal Schorm 2021-08-17 15:55:02 UTC
I made a successful scratch build with LTO enabled and I haven't encountered the error described in the upstream JIRA issue mentioned in the comment 1 during a swift testing of the core replication functionality.

I will take a closer look at it in Fedora. When I will be able to enable LTO there, I'll cherry-pick it to C9S.

Comment 5 Michal Schorm 2021-12-15 10:08:28 UTC
I've enabled the LTO in Fedora:
  https://src.fedoraproject.org/rpms/mariadb/c/643c23352?branch=rawhide

Currently, the builds of MariaDB 10.5, 10.6 and 10.8 are in stable repositories for Fedora 34, 35, Rawhide.

I'll leave it there for a while and if there won't be any negative feedback, we can enable this in C9S / RHEL 9 too.

For now, I'm moving the ITM to January.

Comment 6 Michal Schorm 2022-01-13 08:20:31 UTC
I haven“t received any negative feedback regarding the LTO in Fedora.
I proceeded to enable it in RHEL 9 too:
  https://gitlab.com/redhat/centos-stream/rpms/mariadb/-/commit/23822d7ce304ff07316f4668a7a3b584e3e70812

Comment 14 errata-xmlrpc 2022-05-17 12:42:41 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: mariadb), 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:2381