From: "Martin Liška" <mliska@suse.cz>
To: binutils@sourceware.org
Cc: Jan Beulich <jbeulich@suse.com>
Subject: [PATCH V2] testsuite: support mold linker
Date: Mon, 5 Dec 2022 14:48:16 +0100 [thread overview]
Message-ID: <e41a37eb-20ae-b5ef-9ab3-6e38682bfbd3@suse.cz> (raw)
In-Reply-To: <83618407-1683-8805-58d9-c7ac27263ddc@suse.cz>
Mold linker demotes symbols like main to be local and the patch
adjusts expected output from nm.
Moreover, simplify the patterns and remove accidental type 'D' that
is supported value for _?main functions.
---
binutils/testsuite/binutils-all/addr2line.exp | 4 ++--
binutils/testsuite/binutils-all/objcopy.exp | 6 ++----
libbacktrace/Makefile.am | 2 +-
libbacktrace/Makefile.in | 2 +-
4 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/binutils/testsuite/binutils-all/addr2line.exp b/binutils/testsuite/binutils-all/addr2line.exp
index 66a2d5d32a0..957ae55df33 100644
--- a/binutils/testsuite/binutils-all/addr2line.exp
+++ b/binutils/testsuite/binutils-all/addr2line.exp
@@ -34,7 +34,7 @@ if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog executable debug
#testcase for default option.
#Run nm command and input the main symbol address to addr2line.
set output [binutils_run $NM "$opts tmpdir/testprog$exe"]
-if ![regexp -line "^(\[0-9a-fA-F\]+)? +T ${dot}main" $output contents] then {
+if ![regexp -line "^(\[0-9a-fA-F\]+)? +\[Tt\] ${dot}main" $output contents] then {
fail "$testname"
} else {
set list [regexp -inline -all -- {\S+} $contents]
@@ -49,7 +49,7 @@ if ![regexp -line "^(\[0-9a-fA-F\]+)? +T ${dot}main" $output contents] then {
#testcase for -f option.
#Run nm command and input the fn function symbol address to addr2line.
-if ![regexp -line "^(\[0-9a-fA-F\]+)? +T ${dot}fn" $output contents] then {
+if ![regexp -line "^(\[0-9a-fA-F\]+)? +\[Tt\] ${dot}fn" $output contents] then {
fail "$testname -f option"
} else {
set list [regexp -inline -all -- {\S+} $contents]
diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp
index de6f3aaaef2..7a1a36b9b57 100644
--- a/binutils/testsuite/binutils-all/objcopy.exp
+++ b/binutils/testsuite/binutils-all/objcopy.exp
@@ -652,8 +652,7 @@ proc strip_test_with_saving_a_symbol { } {
set exec_output [binutils_run $NM "$NMFLAGS $objfile"]
set exec_output [prune_warnings $exec_output]
- if {![regexp {^([0-9a-fA-F]+)?[ ]+[TD] main} $exec_output] \
- && ![regexp {^([0-9a-fA-F]+)?[ ]+T _main} $exec_output]} {
+ if {![regexp {^([0-9a-fA-F]+)?[ ]+[tT] _?main} $exec_output]} {
fail $test
return
}
@@ -902,8 +901,7 @@ proc strip_executable_with_saving_a_symbol { prog flags test1 test2 } {
regsub "^\[0-9a-fA-F\]+\[ \]+T Main\[\n\r\]+" $exec_output "" exec_output
}
- if {![regexp {^([0-9a-fA-F]+)?[ ]+[TD] main} $exec_output] \
- && ![regexp {^([0-9a-fA-F]+)?[ ]+[TD] _main} $exec_output]} {
+ if {![regexp {^([0-9a-fA-F]+)?[ ]+[Tt] _?main} $exec_output]} {
fail $test1
return
}
diff --git a/libbacktrace/Makefile.am b/libbacktrace/Makefile.am
index 8874f41338a..bf9d30a382c 100644
--- a/libbacktrace/Makefile.am
+++ b/libbacktrace/Makefile.am
@@ -498,7 +498,7 @@ TESTS += mtest_minidebug
%_minidebug: %
$(NM) -D $< -P --defined-only | $(AWK) '{ print $$1 }' | sort > $<.dsyms
- $(NM) $< -P --defined-only | $(AWK) '{ if ($$2 == "T" || $$2 == "t" || $$2 == "D") print $$1 }' | sort > $<.fsyms
+ $(NM) $< -P --defined-only | $(AWK) '{ if ($$2 == "T" || $$2 == "t" || $$2 == "D" || $$2 == "d") print $$1 }' | sort > $<.fsyms
$(COMM) -13 $<.dsyms $<.fsyms > $<.keepsyms
$(OBJCOPY) --only-keep-debug $< $<.dbg
$(OBJCOPY) -S --remove-section .gdb_index --remove-section .comment --keep-symbols=$<.keepsyms $<.dbg $<.mdbg
diff --git a/libbacktrace/Makefile.in b/libbacktrace/Makefile.in
index 2ba8dfa8428..5167ca80ad1 100644
--- a/libbacktrace/Makefile.in
+++ b/libbacktrace/Makefile.in
@@ -2459,7 +2459,7 @@ uninstall-am:
@HAVE_MINIDEBUG_TRUE@@NATIVE_TRUE@%_minidebug: %
@HAVE_MINIDEBUG_TRUE@@NATIVE_TRUE@ $(NM) -D $< -P --defined-only | $(AWK) '{ print $$1 }' | sort > $<.dsyms
-@HAVE_MINIDEBUG_TRUE@@NATIVE_TRUE@ $(NM) $< -P --defined-only | $(AWK) '{ if ($$2 == "T" || $$2 == "t" || $$2 == "D") print $$1 }' | sort > $<.fsyms
+@HAVE_MINIDEBUG_TRUE@@NATIVE_TRUE@ $(NM) $< -P --defined-only | $(AWK) '{ if ($$2 == "T" || $$2 == "t" || $$2 == "D" || $$2 == "d") print $$1 }' | sort > $<.fsyms
@HAVE_MINIDEBUG_TRUE@@NATIVE_TRUE@ $(COMM) -13 $<.dsyms $<.fsyms > $<.keepsyms
@HAVE_MINIDEBUG_TRUE@@NATIVE_TRUE@ $(OBJCOPY) --only-keep-debug $< $<.dbg
@HAVE_MINIDEBUG_TRUE@@NATIVE_TRUE@ $(OBJCOPY) -S --remove-section .gdb_index --remove-section .comment --keep-symbols=$<.keepsyms $<.dbg $<.mdbg
--
2.38.1
next prev parent reply other threads:[~2022-12-05 13:48 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-05 12:10 [PATCH] " Martin Liška
2022-12-05 12:22 ` Jan Beulich
2022-12-05 13:46 ` Martin Liška
2022-12-05 13:48 ` Martin Liška [this message]
2022-12-05 14:08 ` [PATCH V2] " Jan Beulich
2022-12-05 14:24 ` Martin Liška
2022-12-05 14:48 ` Jan Beulich
2022-12-05 14:52 ` Martin Liška
2022-12-05 15:13 ` Jan Beulich
2022-12-05 14:25 ` Jakub Jelinek
2022-12-05 14:41 ` [PATCH V3] " Martin Liška
2022-12-05 14:50 ` Jan Beulich
2022-12-07 0:36 ` Fangrui Song
2022-12-07 0:42 ` Fangrui Song
2022-12-07 13:01 ` Martin Liška
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=e41a37eb-20ae-b5ef-9ab3-6e38682bfbd3@suse.cz \
--to=mliska@suse.cz \
--cc=binutils@sourceware.org \
--cc=jbeulich@suse.com \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).