Blame SOURCES/libtool-2.4.6-disable-lto-link-order2.patch

0a8f61
Enabling lto will result in failure during test phase, to be precise test 67 will cause it.
0a8f61
Compiler flags for this test (and most likely for rest of them) are inherited from actual build phase.
0a8f61
I'm not sure if this is expected.
0a8f61
0a8f61
Most distribution disables this test. We try to keep it by stripping lto flags for it.
0a8f61
0a8f61
Origin for this tests: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=391427
0a8f61
0a8f61
--- a/tests/link-order2.at	2015-01-16 19:52:04.000000000 +0100
0a8f61
+++ b/tests/link-order2_new.at	2021-11-30 02:01:09.574451906 +0100
0a8f61
@@ -47,6 +47,8 @@
0a8f61
 AT_KEYWORDS([libtool])
0a8f61
 AT_KEYWORDS([interactive])dnl running 'wrong' may cause a popup window.
0a8f61
 
0a8f61
+NO_LTO_CFLAGS=${CFLAGS/-flto*-ffat-lto-objects }
0a8f61
+
0a8f61
 eval `$LIBTOOL --config | $EGREP '^(shlibpath_var|allow_undefined_flag)='`
0a8f61
 
0a8f61
 undefined_setting=-no-undefined
0a8f61
@@ -89,12 +91,12 @@
0a8f61
 EOF
0a8f61
 
0a8f61
 for file in a0 a1 b; do
0a8f61
-  $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c $file.c
0a8f61
+  $LIBTOOL --mode=compile $CC $CPPFLAGS $NO_LTO_CFLAGS -c $file.c
0a8f61
 done
0a8f61
-$CC $CPPFLAGS $CFLAGS -c main.c
0a8f61
+$CC $CPPFLAGS $NO_LTO_CFLAGS -c main.c
0a8f61
 
0a8f61
 # Build an old, installed library.
0a8f61
-$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $static -o liba0.la a0.lo -rpath $deflibdir
0a8f61
+$LIBTOOL --mode=link $CC $NO_LTO_CFLAGS $LDFLAGS $static -o liba0.la a0.lo -rpath $deflibdir
0a8f61
 $LIBTOOL --mode=install cp liba0.la $deflibdir/liba0.la
0a8f61
 $LIBTOOL --mode=clean rm -f liba0.la
0a8f61
 
0a8f61
@@ -118,13 +120,13 @@
0a8f61
     esac
0a8f61
     test non-libtool,-static-libtool-libs = "$type_of_depdepl,$static" &&
0a8f61
        static=-all-static
0a8f61
-    $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $static -o liba1.la a1.lo -rpath $libdir
0a8f61
-    $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $static -o libb.la b.lo liba1.la -rpath $libdir
0a8f61
-    AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $static -o main$EXEEXT main.$OBJEXT libb.la -la0],
0a8f61
+    $LIBTOOL --mode=link $CC $NO_LTO_CFLAGS $LDFLAGS $static -o liba1.la a1.lo -rpath $libdir
0a8f61
+    $LIBTOOL --mode=link $CC $NO_LTO_CFLAGS $LDFLAGS $static -o libb.la b.lo liba1.la -rpath $libdir
0a8f61
+    AT_CHECK([$LIBTOOL --mode=link $CC $NO_LTO_CFLAGS $LDFLAGS $static -o main$EXEEXT main.$OBJEXT libb.la -la0],
0a8f61
 	     [], [ignore], [ignore])
0a8f61
     LT_AT_EXEC_CHECK([./main])
0a8f61
     # Now test that if we reverse the link order, the program fails.
0a8f61
-    AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $static -o wrong$EXEEXT main.$OBJEXT -la0 libb.la],
0a8f61
+    AT_CHECK([$LIBTOOL --mode=link $CC $NO_LTO_CFLAGS $LDFLAGS $static -o wrong$EXEEXT main.$OBJEXT -la0 libb.la],
0a8f61
 	     [], [ignore], [ignore])
0a8f61
     if test yes, != "$shared_fails,$static"; then
0a8f61
       LT_AT_EXEC_CHECK([./wrong], [1], [], [ignore], [|| (exit 1)])