From 74058f9770441b4dd984abf471a00739f0dafaee Mon Sep 17 00:00:00 2001 From: Marek Kulik Date: Tue, 30 Nov 2021 03:20:09 +0100 Subject: [PATCH] Enable lto Changes: - Enable lto - Disable LTO for link-order2 test (Related: #1988112) --- libtool-2.4.6-disable-lto-link-order2.patch | 53 +++++++++++++++++++++ libtool.spec | 15 ++++-- 2 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 libtool-2.4.6-disable-lto-link-order2.patch diff --git a/libtool-2.4.6-disable-lto-link-order2.patch b/libtool-2.4.6-disable-lto-link-order2.patch new file mode 100644 index 0000000..5e403e9 --- /dev/null +++ b/libtool-2.4.6-disable-lto-link-order2.patch @@ -0,0 +1,53 @@ +Enabling lto will result in failure during test phase, to be precise test 67 will cause it. +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. + +Most distribution disables this test. We try to keep it by stripping lto flags for it. + +Origin for this tests: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=391427 + +--- a/tests/link-order2.at 2015-01-16 19:52:04.000000000 +0100 ++++ b/tests/link-order2_new.at 2021-11-30 02:01:09.574451906 +0100 +@@ -47,6 +47,8 @@ + AT_KEYWORDS([libtool]) + AT_KEYWORDS([interactive])dnl running 'wrong' may cause a popup window. + ++NO_LTO_CFLAGS=${CFLAGS/-flto*-ffat-lto-objects } ++ + eval `$LIBTOOL --config | $EGREP '^(shlibpath_var|allow_undefined_flag)='` + + undefined_setting=-no-undefined +@@ -89,12 +91,12 @@ + EOF + + for file in a0 a1 b; do +- $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c $file.c ++ $LIBTOOL --mode=compile $CC $CPPFLAGS $NO_LTO_CFLAGS -c $file.c + done +-$CC $CPPFLAGS $CFLAGS -c main.c ++$CC $CPPFLAGS $NO_LTO_CFLAGS -c main.c + + # Build an old, installed library. +-$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $static -o liba0.la a0.lo -rpath $deflibdir ++$LIBTOOL --mode=link $CC $NO_LTO_CFLAGS $LDFLAGS $static -o liba0.la a0.lo -rpath $deflibdir + $LIBTOOL --mode=install cp liba0.la $deflibdir/liba0.la + $LIBTOOL --mode=clean rm -f liba0.la + +@@ -118,13 +120,13 @@ + esac + test non-libtool,-static-libtool-libs = "$type_of_depdepl,$static" && + static=-all-static +- $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $static -o liba1.la a1.lo -rpath $libdir +- $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $static -o libb.la b.lo liba1.la -rpath $libdir +- AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $static -o main$EXEEXT main.$OBJEXT libb.la -la0], ++ $LIBTOOL --mode=link $CC $NO_LTO_CFLAGS $LDFLAGS $static -o liba1.la a1.lo -rpath $libdir ++ $LIBTOOL --mode=link $CC $NO_LTO_CFLAGS $LDFLAGS $static -o libb.la b.lo liba1.la -rpath $libdir ++ AT_CHECK([$LIBTOOL --mode=link $CC $NO_LTO_CFLAGS $LDFLAGS $static -o main$EXEEXT main.$OBJEXT libb.la -la0], + [], [ignore], [ignore]) + LT_AT_EXEC_CHECK([./main]) + # Now test that if we reverse the link order, the program fails. +- AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $static -o wrong$EXEEXT main.$OBJEXT -la0 libb.la], ++ AT_CHECK([$LIBTOOL --mode=link $CC $NO_LTO_CFLAGS $LDFLAGS $static -o wrong$EXEEXT main.$OBJEXT -la0 libb.la], + [], [ignore], [ignore]) + if test yes, != "$shared_fails,$static"; then + LT_AT_EXEC_CHECK([./wrong], [1], [], [ignore], [|| (exit 1)]) diff --git a/libtool.spec b/libtool.spec index 9ff4b8f..53da720 100644 --- a/libtool.spec +++ b/libtool.spec @@ -8,7 +8,7 @@ Summary: The GNU Portable Library Tool Name: libtool Version: 2.4.6 -Release: 44%{?dist} +Release: 45%{?dist} License: GPLv2+ and LGPLv2+ and GFDL URL: http://www.gnu.org/software/libtool/ @@ -33,6 +33,11 @@ Patch3: libtool-2.4.6-hardening.patch # rhbz#1622611, upstream 350082b6aa89f9ef603fcebbb4cf33f15a743f2f Patch4: libtool-2.4.6-fatal-handler.patch +# 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. (by Jeff Law) +# Disable LTO for link-order2 test (Related: #1988112) +Patch5: libtool-2.4.6-disable-lto-link-order2.patch + %if ! 0%{?_module_build} Patch100: libtool-nodocs.patch %endif @@ -107,6 +112,7 @@ Static libraries and header files for development with ltdl. %patch2 -p1 -b .gcc-specs %patch3 -p1 -b .ltdl-hardening %patch4 -p1 -b .fatal-handler +%patch5 -p1 -b .disable-lto-link-order2 %if ! 0%{?_module_build} %patch100 -p1 -b .nodocs %endif @@ -114,9 +120,6 @@ Static libraries and header files for development with ltdl. autoreconf -v %build -# 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} export CC=gcc @@ -187,6 +190,10 @@ rm -f %{buildroot}%{_libdir}/libltdl.{a,la} %changelog +* Mon Nov 29 2021 Marek Kulik - 2.4.6-45 +- Enable LTO build +- Add disable-lto-link-order2.patch to pass tests + * Mon Oct 04 2021 Ondrej Dubaj - 2.4.6-44 - rebuild with automake-1.16.5