From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1851) id 6920438A90AB; Mon, 5 Dec 2022 14:53:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6920438A90AB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1670251991; bh=KqvP2t1Ft6EgYrxipUgcv9vyu/vT0xDHmxzibpimrOM=; h=From:To:Subject:Date:From; b=FtqE6eyzACbeaR2UswrXO6TN4ULIyuePukTAZgnwkMvCvtorAYONyV6UEMjRMtMTD 6ivGgl4KCaFwzqwA9A/nWETJy5Gg6FyKk5oGNgZockMNPmmpAYlcRoMoq+t7l0Zzzy 4M5tp6XW6B0fvmh2vw31XcN7h9KPpNCTztT70xp4= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Martin Liska To: bfd-cvs@sourceware.org, gdb-cvs@sourceware.org Subject: [binutils-gdb] testsuite: support mold linker X-Act-Checkin: binutils-gdb X-Git-Author: Martin Liska X-Git-Refname: refs/heads/master X-Git-Oldrev: adc48a49264637719620b4d52224774cdc4607c8 X-Git-Newrev: 76a2bcc6b8b07ddfd5093773c4b5fd8e54752fbc Message-Id: <20221205145311.6920438A90AB@sourceware.org> Date: Mon, 5 Dec 2022 14:53:11 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D76a2bcc6b8b0= 7ddfd5093773c4b5fd8e54752fbc commit 76a2bcc6b8b07ddfd5093773c4b5fd8e54752fbc Author: Martin Liska Date: Mon Dec 5 13:09:12 2022 +0100 testsuite: support mold linker =20 Mold linker demotes symbols like main to be local and the patch adjusts expected output from nm. =20 Moreover, simplify the regex patterns. Diff: --- 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/tests= uite/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/te= stprog 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] the= n { +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" $out= put contents] then { =20 #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/testsui= te/binutils-all/objcopy.exp index de6f3aaaef2..e3388597f56 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 { } { =20 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]+)?[ ]+[TtDd] _?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 } =20 - 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]+)?[ ]+[TtDd] _?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 +=3D mtest_minidebug =20 %_minidebug: % $(NM) -D $< -P --defined-only | $(AWK) '{ print $$1 }' | sort > $<.dsyms - $(NM) $< -P --defined-only | $(AWK) '{ if ($$2 =3D=3D "T" || $$2 =3D=3D "= t" || $$2 =3D=3D "D") print $$1 }' | sort > $<.fsyms + $(NM) $< -P --defined-only | $(AWK) '{ if ($$2 =3D=3D "T" || $$2 =3D=3D "= t" || $$2 =3D=3D "D" || $$2 =3D=3D "d") print $$1 }' | sort > $<.fsyms $(COMM) -13 $<.dsyms $<.fsyms > $<.keepsyms $(OBJCOPY) --only-keep-debug $< $<.dbg $(OBJCOPY) -S --remove-section .gdb_index --remove-section .comment --kee= p-symbols=3D$<.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: =20 @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 =3D=3D "T" || $$2 =3D=3D "t" || $$2 =3D=3D "D") print $$1 }' | sort= > $<.fsyms +@HAVE_MINIDEBUG_TRUE@@NATIVE_TRUE@ $(NM) $< -P --defined-only | $(AWK) '{ = if ($$2 =3D=3D "T" || $$2 =3D=3D "t" || $$2 =3D=3D "D" || $$2 =3D=3D "d") p= rint $$1 }' | sort > $<.fsyms @HAVE_MINIDEBUG_TRUE@@NATIVE_TRUE@ $(COMM) -13 $<.dsyms $<.fsyms > $<.keep= syms @HAVE_MINIDEBUG_TRUE@@NATIVE_TRUE@ $(OBJCOPY) --only-keep-debug $< $<.dbg @HAVE_MINIDEBUG_TRUE@@NATIVE_TRUE@ $(OBJCOPY) -S --remove-section .gdb_ind= ex --remove-section .comment --keep-symbols=3D$<.keepsyms $<.dbg $<.mdbg