Disable building static libraries with LTO.

Resolves: RHEL-18800
This commit is contained in:
Nick Clifton 2023-12-12 12:38:32 +00:00
parent 3cd6cf3f9a
commit a7b08ac0bc

View File

@ -9,7 +9,7 @@ BuildRequires: scl-utils-build
Summary: A GNU collection of binary utilities
Name: %{?scl_prefix}binutils
Version: 2.40
Release: 15%{?dist}
Release: 16%{?dist}
License: GPLv3+
URL: https://sourceware.org/binutils
@ -958,29 +958,35 @@ install_binutils()
%endif
# Rebuild the static libiaries with -fPIC.
# It would be nice to build the static libraries with -fno-lto so that
# they can be used by programs that are built with a different version
# of GCC from the one used to build the libraries, but this will trigger
# warnings from annocheck.
#
# Also disable LTO. This is because older versions of GCC can crash if
# asked to parse the LTO information generated by newer versions.
# cf: https://issues.redhat.com/browse/RHEL-18800
#
# Note - disabling LTO does mean that the binutils will be flagged by
# annocheck as being non-compliant. There is not a lot that can be
# done about this. :-(
local static_cflags="-g $RPM_OPT_FLAGS -fPIC -fno-lto"
# Future: Remove libiberty together with its header file, projects should bundle it.
%make_build -s -C libiberty clean
%set_build_flags
%make_build -s CFLAGS="-g -fPIC $RPM_OPT_FLAGS" -C libiberty
%make_build -s -C libiberty CFLAGS="$static_cflags"
# Without the hidden visibility the 3rd party shared libraries would export
# the bfd non-stable ABI.
%make_build -s -C bfd clean
%set_build_flags
%make_build -s CFLAGS="-g -fPIC $RPM_OPT_FLAGS -fvisibility=hidden" LD=%gcc_for_libraries -C bfd
%make_build -s -C bfd CFLAGS="$static_cflags -fvisibility=hidden" LD=%gcc_for_libraries
%make_build -s -C opcodes clean
%set_build_flags
%make_build -s CFLAGS="-g -fPIC $RPM_OPT_FLAGS" -C opcodes
%make_build -s -C opcodes CFLAGS="$static_cflags"
%make_build -s -C libsframe clean
%set_build_flags
%make_build -s CFLAGS="-g -fPIC $RPM_OPT_FLAGS" -C libsframe
%make_build -s -C libsframe CFLAGS="$static_cflags"
install -m 644 bfd/libbfd.a $local_libdir
install -m 644 libiberty/libiberty.a $local_libdir
@ -1279,6 +1285,9 @@ exit 0
#----------------------------------------------------------------------------
%changelog
* Tue Dec 12 2023 Nick Clifton <nickc@redhat.com> - 2.40-16
- Disable building static libraries with LTO. (RHEL-18800)
* Mon Sep 11 2023 Nick Clifton <nickc@redhat.com> - 2.40-15
- Restore the SE context during the post install phase. (#2236729)