Compare commits

...

2 Commits

Author SHA1 Message Date
openeuler-ci-bot 03b8a345e1 !26 [sync] PR-22: pass -Wl,xxx options before libraries
From: @openeuler-sync-bot 
Reviewed-by: @gaoruoshu 
Signed-off-by: @gaoruoshu
2024-10-25 02:02:10 +00:00
Funda Wang b4d3244b98 pass -Wl,xxx options before libraries
(cherry picked from commit 50fc2e7ba9)
2024-10-24 11:45:34 +08:00
3 changed files with 79 additions and 16 deletions
@@ -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)])
+25 -15
View File
@@ -3,18 +3,19 @@
Name: libtool
Version: 2.4.7
Release: 3
License: GPLv2+ and LGPLv2+ and GFDL-1.3-or-later
Release: 4
License: GPL-2.0-or-later AND LGPL-2.0-or-later and GFDL-1.3-or-later
Summary: The GNU Portable Library Tool
URL: http://www.gnu.org/software/libtool/
Source0: http://ftp.gnu.org/gnu/libtool/libtool-%{version}.tar.xz
URL: https://www.gnu.org/software/libtool/
Source0: https://ftp.gnu.org/gnu/libtool/libtool-%{version}.tar.xz
Patch0: libtool-2.4.5-rpath.patch
Patch0: libtool-2.4.5-rpath.patch
Patch1: libtool-2.4.6-disable-lto-link-order2.patch
Patch6000: backport-tests-link-order.at-avoid-warning-and-test-failure.patch
Requires: gcc(major),autoconf, automake, sed, tar, findutils
BuildRequires: texinfo autoconf automake help2man
BuildRequires: texinfo autoconf automake help2man
BuildRequires: libstdc++-devel gcc-gfortran gcc gcc-c++
%description
@@ -22,8 +23,9 @@ GNU libtool is a generic library support script.
Libtool hides the complexity of using shared libraries behind a consistent, portable interface.
%package ltdl
Summary: Runtime libraries for GNU Libtool Dynamic Module Loader
Summary: Runtime libraries for GNU Libtool Dynamic Module Loader
Provides: %{name}-libs = %{version}-%{release}
License: LGPL-2.1-or-later
%description ltdl
The libtool-ltdl package contains the GNU Libtool Dynamic Module Loader, a
@@ -32,11 +34,11 @@ process of using dynamic modules.
%package devel
Summary: Tools needed for development using the GNU Libtool Dynamic Module Loader
License: LGPLv2+
License: LGPL-2.0-or-later
Requires: automake
Requires: %{name}-ltdl = %{version}-%{release}
Provides: %{name}-ltdl-devel
Obsoletes: %{name}-ltdl-devel
Provides: %{name}-ltdl-devel = %{version}-%{release}
Obsoletes: %{name}-ltdl-devel < %{version}-%{release}
%description devel
Static libraries and header files for development with ltdl.
@@ -45,10 +47,14 @@ Static libraries and header files for development with ltdl.
%prep
%autosetup -n libtool-%{version} -p1
autoreconf -v
# Fix libtool to pass -Wl,xxx options before libraries
sed -i \
-e 's,$libobjs $deplibs $compiler_flags,$compiler_flags $libobjs $deplibs,' \
-e 's,$predep_objects $libobjs $deplibs $postdep_objects $compiler_flags,$compiler_flags $predep_objects $libobjs $deplibs $postdep_objects,' \
m4/libtool.m4
%build
autoreconf -v
export CC=gcc
export CXX=g++
export F77=gfortran
@@ -69,12 +75,12 @@ export FCFLAGS="$RPM_OPT_FLAGS -fPIC"
%make_build CUSTOM_LTDL_CFLAGS="%_hardening_cflags" CUSTOM_LTDL_LDFLAGS="%_hardening_ldflags"
%check
make check VERBOSE=yes
%make_build check VERBOSE=yes
%install
%make_install
%delete_la_and_a
rm -f %{buildroot}%{_infodir}/dir
rm -f %{buildroot}%{_libdir}/libltdl.{a,la}
%files
%license COPYING
@@ -100,12 +106,16 @@ rm -f %{buildroot}%{_libdir}/libltdl.{a,la}
%files help
%doc README
%{_infodir}/libtool.info*.gz
%{_infodir}/libtool.info*
%{_mandir}/man1/libtool.1*
%{_mandir}/man1/libtoolize.1*
%changelog
* Thu Sep 26 2024 Funda Wang <fundawang@yeah.net> - 2.4.7-4
- pass -Wl,xxx options before libraries
- disable LTO for link-order2 test
* Tue Jun 06 2023 laokz <zhangkai@iscas.ac.cn> - 2.4.7-3
- add -fPIC to fortran flags for riscv
+1 -1
View File
@@ -1,4 +1,4 @@
version_control: git
src_repo: https://git.savannah.gnu.org/git/libtool.git
tag_prefix: ^v
seperator: .
separator: .