public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
Date: Wed, 12 Mar 2025 20:21:56 +0000 (UTC)	[thread overview]
Message-ID: <1741810908.c61c48e5527b9027fc85b529b8d61fdf5c19920a.sam@gentoo> (raw)

commit:     c61c48e5527b9027fc85b529b8d61fdf5c19920a
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 12 20:21:48 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Mar 12 20:21:48 2025 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=c61c48e5

9999: add testsuite patch from H.J.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...-Adjust-testsuites-for-flto-and-without-g.patch | 260 +++++++++++++++++++++
 1 file changed, 260 insertions(+)

diff --git a/9999/0005-Adjust-testsuites-for-flto-and-without-g.patch b/9999/0005-Adjust-testsuites-for-flto-and-without-g.patch
new file mode 100644
index 0000000..607e838
--- /dev/null
+++ b/9999/0005-Adjust-testsuites-for-flto-and-without-g.patch
@@ -0,0 +1,260 @@
+From f22ea3e751a11ab8cfb5524468d97a998cca0325 Mon Sep 17 00:00:00 2001
+Message-ID: <f22ea3e751a11ab8cfb5524468d97a998cca0325.1741810888.git.sam@gentoo.org>
+From: "H.J. Lu" <hjl.tools@gmail.com>
+Date: Mon, 10 Mar 2025 17:07:16 -0700
+Subject: [PATCH] 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 <hjl.tools@gmail.com>
+---
+ binutils/testsuite/binutils-all/objcopy.exp | 14 +++++++++++---
+ gprof/testsuite/Makefile.am                 | 10 +++++-----
+ gprof/testsuite/Makefile.in                 | 12 +++++-------
+ ld/testsuite/ld-ctf/ctf.exp                 |  5 +++++
+ libctf/Makefile.am                          |  3 ++-
+ libctf/Makefile.in                          |  3 ++-
+ libctf/testsuite/lib/ctf-lib.exp            | 14 ++++++++++++--
+ 7 files changed, 42 insertions(+), 19 deletions(-)
+
+diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp
+index a706efbba18..42a29927a5d 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
+     }
+@@ -1381,10 +1388,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/gprof/testsuite/Makefile.am b/gprof/testsuite/Makefile.am
+index c4d6c41fcf4..0c80b12e6e4 100644
+--- a/gprof/testsuite/Makefile.am
++++ b/gprof/testsuite/Makefile.am
+@@ -6,12 +6,12 @@ GPROF = ../gprof$(EXEEXT)
+ 
+ # NB: -O2 -fno-omit-frame-pointer is needed for expected call graph.  See
+ # https://sourceware.org/bugzilla/show_bug.cgi?id=32768
+-GPROF_FLAGS = -O2 -fno-omit-frame-pointer -pg
++# -g is needed for line number info checked by tst-gmon-gprof-l.sh.  See
++# https://sourceware.org/bugzilla/show_bug.cgi?id=32779
++GPROF_FLAGS = -O2 -fno-omit-frame-pointer -pg -g
+ 
+-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+-	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(GPROF_FLAGS)
+-LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(OPT_NO_PLUGINS) $(GPROF_FLAGS) \
+-	$(AM_LDFLAGS) $(LDFLAGS) -o $@
++COMPILE = $(CC) $(AM_CFLAGS) $(GPROF_FLAGS)
++LINK = $(CC) $(AM_CFLAGS) $(GPROF_FLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+ 
+ # We will add to these later, for each individual test.  Note
+ # that we add each test under check_SCRIPTS;
+diff --git a/gprof/testsuite/Makefile.in b/gprof/testsuite/Makefile.in
+index 008f6be879e..2ac5f241012 100644
+--- a/gprof/testsuite/Makefile.in
++++ b/gprof/testsuite/Makefile.in
+@@ -496,13 +496,11 @@ GPROF = ../gprof$(EXEEXT)
+ 
+ # NB: -O2 -fno-omit-frame-pointer is needed for expected call graph.  See
+ # https://sourceware.org/bugzilla/show_bug.cgi?id=32768
+-GPROF_FLAGS = -O2 -fno-omit-frame-pointer -pg
+-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+-	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(GPROF_FLAGS)
+-
+-LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(OPT_NO_PLUGINS) $(GPROF_FLAGS) \
+-	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+-
++# -g is needed for line number info checked by tst-gmon-gprof-l.sh.  See
++# https://sourceware.org/bugzilla/show_bug.cgi?id=32779
++GPROF_FLAGS = -O2 -fno-omit-frame-pointer -pg -g
++COMPILE = $(CC) $(AM_CFLAGS) $(GPROF_FLAGS)
++LINK = $(CC) $(AM_CFLAGS) $(GPROF_FLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+ 
+ # We will add to these later, for each individual test.  Note
+ # that we add each test under check_SCRIPTS;
+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 6e136220497..bf214d8a000 100644
+--- a/libctf/Makefile.am
++++ b/libctf/Makefile.am
+@@ -102,11 +102,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 5d9587766dc..e5bb94c681b 100644
+--- a/libctf/Makefile.in
++++ b/libctf/Makefile.in
+@@ -1819,11 +1819,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>"
+
+base-commit: add96080cf9e460afe478cfad489d7f22ab10678
+-- 
+2.48.1
+


             reply	other threads:[~2025-03-12 20:21 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-12 20:21 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-03-06 12:54 [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/ Sam James
2025-03-06  4:54 Sam James
2025-02-03 18:02 Andreas K. Hüttel
2025-01-14  2:09 Sam James
2025-01-13  6:11 Sam James
2025-01-02 13:48 Sam James
2025-01-01 14:05 Sam James
2024-12-26  1:21 Sam James
2024-12-24  6:27 Sam James
2024-12-21  0:09 Sam James
2024-08-03 22:43 Andreas K. Hüttel
2024-06-29 17:05 Andreas K. Hüttel
2024-06-29 16:32 Andreas K. Hüttel
2024-06-29 16:32 Andreas K. Hüttel
2024-06-28 21:48 Andreas K. Hüttel
2023-10-27  0:44 Sam James
2023-10-27  0:44 Sam James
2023-07-30 14:49 Andreas K. Hüttel
2023-07-28 16:23 Andreas K. Hüttel
2023-06-30  9:21 WANG Xuerui
2023-04-02 11:44 Andreas K. Hüttel
2023-01-05 16:22 Andreas K. Hüttel
2023-01-05 16:21 Andreas K. Hüttel
2023-01-03 23:03 Andreas K. Hüttel
2023-01-02 23:50 Andreas K. Hüttel
2022-10-08 12:15 WANG Xuerui
2022-07-29  7:55 WANG Xuerui
2022-01-15 22:27 Andreas K. Hüttel
2021-08-17 20:07 Andreas K. Hüttel
2021-07-30 23:25 Andreas K. Hüttel
2021-07-24 20:57 Andreas K. Hüttel
2021-07-20 19:53 Andreas K. Hüttel
2021-07-20 19:50 Andreas K. Hüttel
2021-07-06  7:04 Sergei Trofimovich
2021-07-06  7:04 Sergei Trofimovich
2021-07-06  7:04 Sergei Trofimovich
2020-07-25 17:27 Andreas K. Hüttel
2020-07-25 12:26 Andreas K. Hüttel
2020-07-25 12:23 Andreas K. Hüttel
2020-07-25 12:20 Andreas K. Hüttel
2020-05-19 21:12 Andreas K. Hüttel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1741810908.c61c48e5527b9027fc85b529b8d61fdf5c19920a.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox