diff options
-rw-r--r-- | libtool-2.4.6-disable-lto-link-order2.patch | 53 | ||||
-rw-r--r-- | libtool-2.4.7-hardening.patch | 28 | ||||
-rw-r--r-- | libtool.spec | 11 |
3 files changed, 88 insertions, 4 deletions
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-2.4.7-hardening.patch b/libtool-2.4.7-hardening.patch new file mode 100644 index 0000000..2ad24d2 --- /dev/null +++ b/libtool-2.4.7-hardening.patch @@ -0,0 +1,28 @@ +diff --git a/Makefile.am b/Makefile.am +index 13dfc63..5c5603a 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -311,6 +311,23 @@ libtool: $(ltmain_sh) $(config_status) $(dotversion) + + include libltdl/ltdl.mk + ++libltdl_libltdl_la_CFLAGS = $(CUSTOM_LTDL_CFLAGS) ++libltdl_libltdl_la_LDFLAGS += $(CUSTOM_LTDL_LDFLAGS) ++ ++libltdl_dlopen_la_LDFLAGS += $(CUSTOM_LTDL_LDFLAGS) ++libltdl_dld_link_la_LDFLAGS += $(CUSTOM_LTDL_LDFLAGS) ++libltdl_dyld_la_LDFLAGS += $(CUSTOM_LTDL_LDFLAGS) ++libltdl_load_add_on_la_LDFLAGS += $(CUSTOM_LTDL_LDFLAGS) ++libltdl_loadlibrary_la_LDFLAGS += $(CUSTOM_LTDL_LDFLAGS) ++libltdl_shl_load_la_LDFLAGS += $(CUSTOM_LTDL_LDFLAGS) ++ ++libltdl_dlopen_la_CFLAGS = $(CUSTOM_LTDL_CFLAGS) ++libltdl_dld_link_la_CFLAGS = $(CUSTOM_LTDL_CFLAGS) ++libltdl_dyld_la_CFLAGS = $(CUSTOM_LTDL_CFLAGS) ++libltdl_load_add_on_la_CFLAGS = $(CUSTOM_LTDL_CFLAGS) ++libltdl_loadlibrary_la_CFLAGS = $(CUSTOM_LTDL_CFLAGS) ++libltdl_shl_load_la_CFLAGS = $(CUSTOM_LTDL_CFLAGS) ++ + lt_aclocal_m4 = $(srcdir)/$(ltdl_dir)/aclocal.m4 + lt_config_h_in = $(srcdir)/$(ltdl_dir)/config-h.in + lt_configure = $(srcdir)/$(ltdl_dir)/configure diff --git a/libtool.spec b/libtool.spec index cf6ad3c..cd917c1 100644 --- a/libtool.spec +++ b/libtool.spec @@ -8,11 +8,14 @@ Summary: The GNU Portable Library Tool URL: https://www.gnu.org/software/libtool/ Source0: https://alpha.gnu.org/gnu/libtool/%{name}-%{version}.tar.xz -Patch0: libtool-2.5.1-rpath.patch +Patch0: libtool-2.5.1-rpath.patch +%undefine _hardened_build +Patch1: libtool-2.4.7-hardening.patch +Patch2: libtool-2.4.6-disable-lto-link-order2.patch Requires: gcc(major),autoconf, automake, sed, tar, findutils -BuildRequires: texinfo autoconf automake help2man libtool-devel libtool +BuildRequires: texinfo autoconf automake help2man BuildRequires: libstdc++-devel gcc-gfortran gcc gcc-c++ %description @@ -64,7 +67,7 @@ export FFLAGS="$RPM_OPT_FLAGS -fPIE" export FCFLAGS="$RPM_OPT_FLAGS -fPIE" %endif -%configure --disable-static +%configure %make_build CUSTOM_LTDL_CFLAGS="%_hardening_cflags" CUSTOM_LTDL_LDFLAGS="%_hardening_ldflags" @@ -73,7 +76,7 @@ export FCFLAGS="$RPM_OPT_FLAGS -fPIE" %install %make_install -%delete_la +%delete_la_and_a rm -f %{buildroot}%{_infodir}/dir %files |