commit: e6987ab64c45d4e3bda0711653e6c8ed82a4a40a Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Mon Nov 3 12:25:19 2025 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Mon Nov 3 12:25:19 2025 +0000 URL: https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=e6987ab6
2.45: rebase Signed-off-by: Sam James <sam <AT> gentoo.org> ...iberty-install-PIC-version-of-libiberty.a.patch | 7 +- ...oo-add-with-extra-soversion-suffix-option.patch | 41 ++-- ...-also-libctf-optionally-a-gentoo-specific.patch | 31 ++- ...ilar-libiberty-fix-as-in-7d53105d-for-lib.patch | 21 +-- ...-Adjust-testsuites-for-flto-and-without-g.patch | 210 +++++++++++++++++++++ 5 files changed, 255 insertions(+), 55 deletions(-) diff --git a/2.45/0001-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch b/2.45/0001-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch index a1e4219..3ff9191 100644 --- a/2.45/0001-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch +++ b/2.45/0001-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch @@ -1,8 +1,7 @@ -From 4ebcb339f9d678aef53596022a3e6125dfed109a Mon Sep 17 00:00:00 2001 -Message-ID: <4ebcb339f9d678aef53596022a3e6125dfed109a.1758805647.git....@gentoo.org> +From bd82239c2a628ace1b6fddcec96871641fadfbec Mon Sep 17 00:00:00 2001 From: Mike Frysinger <[email protected]> Date: Fri, 7 Jan 2005 00:15:53 -0500 -Subject: [PATCH 1/4] Gentoo: libiberty: install PIC version of libiberty.a +Subject: [PATCH 1/5] Gentoo: libiberty: install PIC version of libiberty.a This will install a PIC version of libiberty.a by overwriting the non-PIC version of libiberty.a while compiling. We do this because there is no @@ -31,5 +30,5 @@ index d507f27a9ef..51fefcb31c2 100644 else true; fi; \ if [ x"$(NOASANFLAG)" != x ]; then \ -- -2.51.0 +2.49.1 diff --git a/2.45/0002-Gentoo-add-with-extra-soversion-suffix-option.patch b/2.45/0002-Gentoo-add-with-extra-soversion-suffix-option.patch index 10b4901..a1a35fd 100644 --- a/2.45/0002-Gentoo-add-with-extra-soversion-suffix-option.patch +++ b/2.45/0002-Gentoo-add-with-extra-soversion-suffix-option.patch @@ -1,10 +1,7 @@ -From 366a426d48c8ef40810ff0d275b73f86243d50f5 Mon Sep 17 00:00:00 2001 -Message-ID: <366a426d48c8ef40810ff0d275b73f86243d50f5.1758805647.git....@gentoo.org> -In-Reply-To: <4ebcb339f9d678aef53596022a3e6125dfed109a.1758805647.git....@gentoo.org> -References: <4ebcb339f9d678aef53596022a3e6125dfed109a.1758805647.git....@gentoo.org> +From 062144ba260931e309a621355b92a2ca3b1ec12c Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich <[email protected]> Date: Tue, 20 Jul 2021 21:12:38 +0200 -Subject: [PATCH 2/4] Gentoo: add --with-extra-soversion-suffix= option +Subject: [PATCH 2/5] Gentoo: add --with-extra-soversion-suffix= option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -37,7 +34,7 @@ Ported to binutils 2.37 by Andreas K. Hüttel <[email protected]> 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/bfd/Makefile.am b/bfd/Makefile.am -index 3c3243269f1..719d5f2bb52 100644 +index 4987ac9cccc..23de1c6b5d7 100644 --- a/bfd/Makefile.am +++ b/bfd/Makefile.am @@ -64,6 +64,8 @@ bfdinclude_HEADERS += $(INCDIR)/plugin-api.h @@ -49,7 +46,7 @@ index 3c3243269f1..719d5f2bb52 100644 # bfd.h goes here, for now BFD_H = bfd.h -@@ -993,6 +995,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in +@@ -995,6 +997,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in bfd_version_string="\"$(VERSION).$${bfd_version_date}\"" ;\ bfd_soversion="$(VERSION).$${bfd_version_date}" ;\ fi ;\ @@ -60,10 +57,10 @@ index 3c3243269f1..719d5f2bb52 100644 -e "s,@bfd_version_string@,$$bfd_version_string," \ -e "s,@bfd_version_package@,$$bfd_version_package," \ diff --git a/bfd/Makefile.in b/bfd/Makefile.in -index 6d1944c2664..07b1084f6b7 100644 +index 8a670ad1d05..2218f61e604 100644 --- a/bfd/Makefile.in +++ b/bfd/Makefile.in -@@ -349,6 +349,7 @@ ECHO_T = @ECHO_T@ +@@ -347,6 +347,7 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@ @@ -82,7 +79,7 @@ index 6d1944c2664..07b1084f6b7 100644 -e "s,@bfd_version_string@,$$bfd_version_string," \ -e "s,@bfd_version_package@,$$bfd_version_package," \ diff --git a/bfd/configure b/bfd/configure -index d07f9e926e4..013353a2b59 100755 +index 86561b30ac4..317c2f44982 100755 --- a/bfd/configure +++ b/bfd/configure @@ -701,6 +701,7 @@ WARN_CFLAGS @@ -93,7 +90,7 @@ index d07f9e926e4..013353a2b59 100755 DEBUGDIR PLUGINS_FALSE PLUGINS_TRUE -@@ -841,6 +842,7 @@ enable_secureplt +@@ -840,6 +841,7 @@ enable_secureplt enable_separate_code enable_leading_mingw64_underscores with_separate_debug_dir @@ -101,7 +98,7 @@ index d07f9e926e4..013353a2b59 100755 with_pkgversion with_bugurl enable_werror -@@ -1529,6 +1531,8 @@ Optional Packages: +@@ -1528,6 +1530,8 @@ Optional Packages: --with-separate-debug-dir=DIR Look for global separate debug info in DIR [[default=LIBDIR/debug]] @@ -110,25 +107,25 @@ index d07f9e926e4..013353a2b59 100755 --with-pkgversion=PKG Use PKG in the version string in place of "GNU Binutils" --with-bugurl=URL Direct users to URL to report a bug -@@ -11528,7 +11532,7 @@ else +@@ -11153,7 +11157,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF --#line 11531 "configure" -+#line 11535 "configure" +-#line 11156 "configure" ++#line 11160 "configure" #include "confdefs.h" #if HAVE_DLFCN_H -@@ -11634,7 +11638,7 @@ else +@@ -11259,7 +11263,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF --#line 11637 "configure" -+#line 11641 "configure" +-#line 11262 "configure" ++#line 11266 "configure" #include "confdefs.h" #if HAVE_DLFCN_H -@@ -12394,6 +12398,15 @@ fi +@@ -12030,6 +12034,15 @@ fi @@ -145,10 +142,10 @@ index d07f9e926e4..013353a2b59 100755 # Check whether --with-pkgversion was given. diff --git a/bfd/configure.ac b/bfd/configure.ac -index 4fb3bf41f34..b52eba399f1 100644 +index 5879a04785d..3e40e9476a7 100644 --- a/bfd/configure.ac +++ b/bfd/configure.ac -@@ -163,6 +163,13 @@ AC_ARG_WITH(separate-debug-dir, +@@ -173,6 +173,13 @@ AC_ARG_WITH(separate-debug-dir, [DEBUGDIR="${withval}"]) AC_SUBST(DEBUGDIR) @@ -163,5 +160,5 @@ index 4fb3bf41f34..b52eba399f1 100644 ACX_BUGURL([https://sourceware.org/bugzilla/]) -- -2.51.0 +2.49.1 diff --git a/2.45/0003-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch b/2.45/0003-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch index 81d3d05..7a73c68 100644 --- a/2.45/0003-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch +++ b/2.45/0003-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch @@ -1,10 +1,7 @@ -From 07128aa7ebc4a73170d4cebc036c9c64b7529f6e Mon Sep 17 00:00:00 2001 -Message-ID: <07128aa7ebc4a73170d4cebc036c9c64b7529f6e.1758805647.git....@gentoo.org> -In-Reply-To: <4ebcb339f9d678aef53596022a3e6125dfed109a.1758805647.git....@gentoo.org> -References: <4ebcb339f9d678aef53596022a3e6125dfed109a.1758805647.git....@gentoo.org> +From ef7b999d6d7748f0b6e159df52b4b663e5032072 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <[email protected]> Date: Sat, 24 Jul 2021 15:20:16 +0200 -Subject: [PATCH 3/4] Gentoo: Give also libctf optionally a gentoo-specific +Subject: [PATCH 3/5] Gentoo: Give also libctf optionally a gentoo-specific soversion --- @@ -48,10 +45,10 @@ index 6e136220497..12301277275 100644 libctf_nobfd_la_CPPFLAGS = $(AM_CPPFLAGS) -DNOBFD=1 libctf_nobfd_la_SOURCES = ctf-archive.c ctf-dump.c ctf-create.c ctf-decl.c ctf-error.c \ diff --git a/libctf/Makefile.in b/libctf/Makefile.in -index 7c309b1fc04..c71e22d1b72 100644 +index 5d9587766dc..639d7147b02 100644 --- a/libctf/Makefile.in +++ b/libctf/Makefile.in -@@ -432,6 +432,7 @@ AUTOCONF = @AUTOCONF@ +@@ -430,6 +430,7 @@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ @@ -59,7 +56,7 @@ index 7c309b1fc04..c71e22d1b72 100644 CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ -@@ -454,6 +455,7 @@ EXEEXT = @EXEEXT@ +@@ -452,6 +453,7 @@ EXEEXT = @EXEEXT@ # Setup the testing framework, if you have one EXPECT = expect @@ -67,7 +64,7 @@ index 7c309b1fc04..c71e22d1b72 100644 FGREP = @FGREP@ GENCAT = @GENCAT@ GMSGFMT = @GMSGFMT@ -@@ -606,8 +608,13 @@ AM_CFLAGS = -std=gnu99 @ac_libctf_warn_cflags@ @warn@ @c_warn@ @WARN_PEDANTIC@ @ +@@ -603,8 +605,13 @@ AM_CFLAGS = -std=gnu99 @ac_libctf_warn_cflags@ @warn@ @c_warn@ @WARN_PEDANTIC@ @ @INSTALL_LIBBFD_FALSE@include_HEADERS = @INSTALL_LIBBFD_TRUE@include_HEADERS = $(INCDIR)/ctf.h $(INCDIR)/ctf-api.h @INSTALL_LIBBFD_FALSE@noinst_LTLIBRARIES = libctf.la libctf-nobfd.la @@ -83,7 +80,7 @@ index 7c309b1fc04..c71e22d1b72 100644 libctf_nobfd_la_CPPFLAGS = $(AM_CPPFLAGS) -DNOBFD=1 libctf_nobfd_la_SOURCES = ctf-archive.c ctf-dump.c ctf-create.c \ diff --git a/libctf/configure b/libctf/configure -index becb131103a..5179121719c 100755 +index 7466d56a18b..54c86592b70 100755 --- a/libctf/configure +++ b/libctf/configure @@ -646,6 +646,10 @@ BUILD_INFO_FALSE @@ -97,7 +94,7 @@ index becb131103a..5179121719c 100755 ENABLE_LIBCTF_HASH_DEBUGGING_FALSE ENABLE_LIBCTF_HASH_DEBUGGING_TRUE zlibinc -@@ -822,6 +826,7 @@ enable_maintainer_mode +@@ -821,6 +825,7 @@ enable_maintainer_mode enable_install_libbfd with_system_zlib enable_libctf_hash_debugging @@ -105,7 +102,7 @@ index becb131103a..5179121719c 100755 ' ac_precious_vars='build_alias host_alias -@@ -1488,6 +1493,8 @@ Optional Packages: +@@ -1487,6 +1492,8 @@ Optional Packages: both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-system-zlib use installed libz @@ -114,7 +111,7 @@ index becb131103a..5179121719c 100755 Some influential environment variables: CC C compiler command -@@ -16657,6 +16664,26 @@ else +@@ -16274,6 +16281,26 @@ else fi @@ -141,7 +138,7 @@ index becb131103a..5179121719c 100755 # Similar to GDB_AC_CHECK_BFD. OLD_CFLAGS=$CFLAGS OLD_LDFLAGS=$LDFLAGS -@@ -17560,6 +17587,10 @@ if test -z "${ENABLE_LIBCTF_HASH_DEBUGGING_TRUE}" && test -z "${ENABLE_LIBCTF_HA +@@ -17177,6 +17204,10 @@ if test -z "${ENABLE_LIBCTF_HASH_DEBUGGING_TRUE}" && test -z "${ENABLE_LIBCTF_HA as_fn_error $? "conditional \"ENABLE_LIBCTF_HASH_DEBUGGING\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi @@ -153,10 +150,10 @@ index becb131103a..5179121719c 100755 if test -z "${NEED_CTF_QSORT_R_TRUE}" && test -z "${NEED_CTF_QSORT_R_FALSE}"; then as_fn_error $? "conditional \"NEED_CTF_QSORT_R\" was never defined. diff --git a/libctf/configure.ac b/libctf/configure.ac -index 62e62250c80..5266b1381df 100644 +index fbd8ec12a14..3e83f43ba13 100644 --- a/libctf/configure.ac +++ b/libctf/configure.ac -@@ -84,6 +84,16 @@ if test "${enable_libctf_hash_debugging}" = yes; then +@@ -76,6 +76,16 @@ if test "${enable_libctf_hash_debugging}" = yes; then fi AM_CONDITIONAL(ENABLE_LIBCTF_HASH_DEBUGGING, test "${enable_libctf_hash_debugging}" = yes) @@ -174,5 +171,5 @@ index 62e62250c80..5266b1381df 100644 OLD_CFLAGS=$CFLAGS OLD_LDFLAGS=$LDFLAGS -- -2.51.0 +2.49.1 diff --git a/2.45/0004-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch b/2.45/0004-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch index f59e780..bb17a3b 100644 --- a/2.45/0004-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch +++ b/2.45/0004-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch @@ -1,10 +1,7 @@ -From c888b2e67d8e45c20aac1912ff9cd34cbea48d9e Mon Sep 17 00:00:00 2001 -Message-ID: <c888b2e67d8e45c20aac1912ff9cd34cbea48d9e.1758805647.git....@gentoo.org> -In-Reply-To: <4ebcb339f9d678aef53596022a3e6125dfed109a.1758805647.git....@gentoo.org> -References: <4ebcb339f9d678aef53596022a3e6125dfed109a.1758805647.git....@gentoo.org> +From 845089ce66869d79e86869ec1972a33036010706 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <[email protected]> Date: Wed, 22 Feb 2023 20:05:35 +0100 -Subject: [PATCH 4/4] Apply a similar libiberty fix as in 7d53105d for +Subject: [PATCH 4/5] Apply a similar libiberty fix as in 7d53105d for libopcodes and libgprofng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -35,10 +32,10 @@ index f6d3f5da759..36c334bb359 100644 $(GPROFNG_LIBADD) \ -lpthread -ldl diff --git a/gprofng/src/Makefile.in b/gprofng/src/Makefile.in -index 0a1934e8344..374a887adae 100644 +index 0cdd4443670..8021b2d4a3d 100644 --- a/gprofng/src/Makefile.in +++ b/gprofng/src/Makefile.in -@@ -558,7 +558,8 @@ libgprofng_la_LDFLAGS = -version-info 0:0:0 +@@ -552,7 +552,8 @@ libgprofng_la_LDFLAGS = -version-info 0:0:0 # Pass -lpthread instead of $(PTHREAD_LIBS) due to $(PTHREAD_LIBS) being empty # when -nostdlib is passed to libtool. # See bug 29364 - libgprofng.so: needs to link against -pthread @@ -49,10 +46,10 @@ index 0a1934e8344..374a887adae 100644 $(GPROFNG_LIBADD) \ -lpthread -ldl diff --git a/opcodes/configure b/opcodes/configure -index df9f63d1031..8c46bcf79ba 100755 +index 3dd6b692f89..54544895689 100755 --- a/opcodes/configure +++ b/opcodes/configure -@@ -14256,10 +14256,10 @@ if test "$enable_shared" = "yes"; then +@@ -13881,10 +13881,10 @@ if test "$enable_shared" = "yes"; then case "${host}" in *-*-cygwin*) SHARED_LDFLAGS="-no-undefined" @@ -66,10 +63,10 @@ index df9f63d1031..8c46bcf79ba 100755 ;; esac diff --git a/opcodes/configure.ac b/opcodes/configure.ac -index 675f0662700..0220ec13312 100644 +index e31ddde9e57..8fdf538ecf8 100644 --- a/opcodes/configure.ac +++ b/opcodes/configure.ac -@@ -194,10 +194,10 @@ if test "$enable_shared" = "yes"; then +@@ -195,10 +195,10 @@ if test "$enable_shared" = "yes"; then case "${host}" in *-*-cygwin*) SHARED_LDFLAGS="-no-undefined" @@ -83,5 +80,5 @@ index 675f0662700..0220ec13312 100644 ;; esac -- -2.51.0 +2.49.1 diff --git a/2.45/0005-Adjust-testsuites-for-flto-and-without-g.patch b/2.45/0005-Adjust-testsuites-for-flto-and-without-g.patch new file mode 100644 index 0000000..e2735aa --- /dev/null +++ b/2.45/0005-Adjust-testsuites-for-flto-and-without-g.patch @@ -0,0 +1,210 @@ +From 3d6a0b4a3f6b0582781979062cc6730e858997ae Mon Sep 17 00:00:00 2001 +From: "H.J. Lu" <[email protected]> +Date: Mon, 10 Mar 2025 17:07:16 -0700 +Subject: [PATCH 5/5] Adjust testsuites for -flto and without -g + +Adjust testsuites for binutils built with -flto and without -g: + +1. Pass -fno-lto to objcopy tests which don't work with LTO. +2. Update gprof testsuite to avoid LTO and compile with -g for line +number info checked by tst-gmon-gprof-l.sh. +3. Append $NOLTO_CFLAGS in ctf.exp. +4. For libctf, filter out -flto in CFLAGS for "make check" and also +prune lto-wrapper warnings. + +binutils/ + + PR binutils/32773 + * testsuite/binutils-all/objcopy.exp (no_lto_flags): New. + (strip_test): Pass $no_lto_flags to target_compile. + (strip_test_with_saving_a_symbol): Likewise. + (objcopy_test_without_global_symbol): Likewise. + +gprof/ + + PR binutils/32773 + PR gprof/32779 + * testsuite/Makefile.am (GPROF_FLAGS): Add -g. + (COMPILE): Set to "$(CC) $(AM_CFLAGS) $(GPROF_FLAGS)". + (LINK) Set to "$(CC) $(AM_CFLAGS) $(GPROF_FLAGS) $(AM_LDFLAGS) + $(LDFLAGS) -o $@". + * testsuite/Makefile.in: Regenerated. + +ld/ + + PR binutils/32773 + * testsuite/ld-ctf/ctf.exp (old_CFLAGS): New. + (CFLAGS_FOR_TARGET): Append $NOLTO_CFLAGS. + +libctf/ + + PR binutils/32773 + * Makefile.am (check-DEJAGNU): Filter out -flto in CFLAGS. + * Makefile.in: Regenerated. + * testsuite/lib/ctf-lib.exp (prune_warnings_lto): New. + (run_lookup_test): Replace prune_warnings with + prune_warnings_lto. + (run_lookup_test): Likewise. + +Signed-off-by: H.J. Lu <[email protected]> +--- + binutils/testsuite/binutils-all/objcopy.exp | 14 +++++++++++--- + ld/testsuite/ld-ctf/ctf.exp | 5 +++++ + libctf/Makefile.am | 3 ++- + libctf/Makefile.in | 3 ++- + libctf/testsuite/lib/ctf-lib.exp | 14 ++++++++++++-- + 5 files changed, 32 insertions(+), 7 deletions(-) + +diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp +index 6aa6d2d9fe7..9371d928d60 100644 +--- a/binutils/testsuite/binutils-all/objcopy.exp ++++ b/binutils/testsuite/binutils-all/objcopy.exp +@@ -36,6 +36,11 @@ if ![is_remote host] { + set copyfile copy + } + ++set no_lto_flags "additional_flags=-fno-lto" ++if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object $no_lto_flags] != "" } { ++ set no_lto_flags "" ++} ++ + # Test that objcopy does not modify a file when copying it. + # "object" or "executable" values for type are supported. + +@@ -516,10 +521,11 @@ proc strip_test { } { + global srcdir + global subdir + global READELF ++ global no_lto_flags + + set test "strip" + +- if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } { ++ if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object "debug $no_lto_flags"] != "" } { + untested $test + return + } +@@ -628,10 +634,11 @@ proc strip_test_with_saving_a_symbol { } { + global NMFLAGS + global srcdir + global subdir ++ global no_lto_flags + + set test "strip with saving a symbol" + +- if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } { ++ if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object "debug $no_lto_flags"] != "" } { + untested $test + return + } +@@ -1462,10 +1469,11 @@ proc objcopy_test_without_global_symbol { } { + global OBJDUMPFLAGS + global srcdir + global subdir ++ global no_lto_flags + + set test "strip without global symbol " + +- if { [target_compile $srcdir/$subdir/pr19547.c tmpdir/pr19547.o object debug] != "" } { ++ if { [target_compile $srcdir/$subdir/pr19547.c tmpdir/pr19547.o object "debug $no_lto_flags"] != "" } { + untested $test + return + } +diff --git a/ld/testsuite/ld-ctf/ctf.exp b/ld/testsuite/ld-ctf/ctf.exp +index c314f2995af..08b47d2db18 100644 +--- a/ld/testsuite/ld-ctf/ctf.exp ++++ b/ld/testsuite/ld-ctf/ctf.exp +@@ -33,6 +33,9 @@ if ![check_shared_lib_support] { + return 0 + } + ++set old_CFLAGS "$CFLAGS_FOR_TARGET" ++append CFLAGS_FOR_TARGET " $NOLTO_CFLAGS" ++ + if {[info exists env(LC_ALL)]} { + set old_lc_all $env(LC_ALL) + } +@@ -55,3 +58,5 @@ if {[info exists old_lc_all]} { + } else { + unset env(LC_ALL) + } ++ ++set CFLAGS_FOR_TARGET "$old_CFLAGS" +diff --git a/libctf/Makefile.am b/libctf/Makefile.am +index 12301277275..26980667cc3 100644 +--- a/libctf/Makefile.am ++++ b/libctf/Makefile.am +@@ -114,11 +114,12 @@ check-DEJAGNU: site.exp development.exp + else \ + TEST_CROSS=yes; \ + fi; \ ++ TEST_CFLAGS=`echo "$(CFLAGS)" | sed -e "s/-flto[^ \t]*//"`; \ + runtest=$(RUNTEST); \ + if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \ + $$runtest --tool $(DEJATOOL) --srcdir $${srcroot}/testsuite \ + CC="$(CC)" CC_FOR_TARGET="$(CC_FOR_TARGET)" TEST_CROSS="$${TEST_CROSS}" \ +- CFLAGS="$(CFLAGS) -I$(INCDIR) -I$(srcdir) -I$(builddir) -I$(builddir)/../bfd $(ZLIBINC)" \ ++ CFLAGS="$$TEST_CFLAGS -I$(INCDIR) -I$(srcdir) -I$(builddir) -I$(builddir)/../bfd $(ZLIBINC)" \ + LIBS="$(libctf_nobfd_la_LIBADD) $(LIBS)" $(RUNTESTFLAGS); \ + else echo "WARNING: could not find \`runtest'" 1>&2; :;\ + fi +diff --git a/libctf/Makefile.in b/libctf/Makefile.in +index 639d7147b02..812134c70c9 100644 +--- a/libctf/Makefile.in ++++ b/libctf/Makefile.in +@@ -1826,11 +1826,12 @@ check-DEJAGNU: site.exp development.exp + else \ + TEST_CROSS=yes; \ + fi; \ ++ TEST_CFLAGS=`echo "$(CFLAGS)" | sed -e "s/-flto[^ \t]*//"`; \ + runtest=$(RUNTEST); \ + if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \ + $$runtest --tool $(DEJATOOL) --srcdir $${srcroot}/testsuite \ + CC="$(CC)" CC_FOR_TARGET="$(CC_FOR_TARGET)" TEST_CROSS="$${TEST_CROSS}" \ +- CFLAGS="$(CFLAGS) -I$(INCDIR) -I$(srcdir) -I$(builddir) -I$(builddir)/../bfd $(ZLIBINC)" \ ++ CFLAGS="$$TEST_CFLAGS -I$(INCDIR) -I$(srcdir) -I$(builddir) -I$(builddir)/../bfd $(ZLIBINC)" \ + LIBS="$(libctf_nobfd_la_LIBADD) $(LIBS)" $(RUNTESTFLAGS); \ + else echo "WARNING: could not find \`runtest'" 1>&2; :;\ + fi +diff --git a/libctf/testsuite/lib/ctf-lib.exp b/libctf/testsuite/lib/ctf-lib.exp +index 64d2a40ad9f..6d3b75e22a2 100644 +--- a/libctf/testsuite/lib/ctf-lib.exp ++++ b/libctf/testsuite/lib/ctf-lib.exp +@@ -54,6 +54,16 @@ proc compile_link_one_host_cc { src output additional_args } { + return [run_native_host_cmd "./libtool --quiet --tag=CC --mode=link $CC $CFLAGS $src -o $output $additional_args" ] + } + ++# Also prune lto-wrapper warnings, like ++# lto-wrapper: warning: using serial compilation of 16 LTRANS jobs ++# lto-wrapper: note: see the '-flto' option documentation for more information ++# ++proc prune_warnings_lto { msg } { ++ set msgx "lto-wrapper: (?:warning\:\[^\n\r\]+|note\:\[^\n\r\]+)" ++ regsub -all "$msgx\[\n\r\]*" $msg {} msg ++ return [prune_warnings $msg] ++} ++ + # run_lookup_test FILE + # + # Compile with the host compiler and link a .c file into a "lookup" binary, then +@@ -208,7 +218,7 @@ proc run_lookup_test { name } { + set testname $file4log + + # Compile and link the lookup program. +- set comp_output [prune_warnings [compile_link_one_host_cc $opts(lookup) "tmpdir/lookup" "libctf.la $opts(lookup_link)"]] ++ set comp_output [prune_warnings_lto [compile_link_one_host_cc $opts(lookup) "tmpdir/lookup" "libctf.la $opts(lookup_link)"]] + + if { $comp_output != ""} { + send_log "compilation of lookup program $opts(lookup) failed with <$comp_output>" +@@ -244,7 +254,7 @@ proc run_lookup_test { name } { + } + } + +- set comp_output [prune_warnings [run_host_cmd "$CC_FOR_TARGET" "$CFLAGS_FOR_TARGET $lookup_flags [concat $src] -o $lookup_output"]] ++ set comp_output [prune_warnings_lto [run_host_cmd "$CC_FOR_TARGET" "$CFLAGS_FOR_TARGET $lookup_flags [concat $src] -o $lookup_output"]] + + if { $comp_output != ""} { + send_log "compilation of CTF program [concat $src] failed with <$comp_output>" +-- +2.49.1 +
