From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id D313938A8156 for ; Mon, 5 Dec 2022 13:48:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D313938A8156 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 115961FF42; Mon, 5 Dec 2022 13:48:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1670248097; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZCkgapBuExWUFX0sjVFlCVixwNiEIEozlES58zcvmxc=; b=DVsitEbAmmFZITsN38X8L1g0I/xk/hEUa/bl0UkR/q3q6DWhQs/MEYCGDXvqycO9rdIYJc HHBN4xDogrKrZE1eNdngz7x0w4h5wjfFoYyrwzkZx+AdK5YqEJsDZ+xZxGIftDZsk8n/qd 7tt4MaRWQwde26zfPvv1nMUv1OMmlSg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1670248097; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZCkgapBuExWUFX0sjVFlCVixwNiEIEozlES58zcvmxc=; b=ZhIH0/CjNc1f/DKAneVWiauqMh3gFzqdwFgTr5t6RKDwV8WxFVLButZyPbilSvt5QXSHRq qIA4cdC0GPNPZaBQ== Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap1.suse-dmz.suse.de (Postfix) with ESMTPS id F1C8A13326; Mon, 5 Dec 2022 13:48:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id vmYSOqD2jWODegAAGKfGzw (envelope-from ); Mon, 05 Dec 2022 13:48:16 +0000 Message-ID: Date: Mon, 5 Dec 2022 14:48:16 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Subject: [PATCH V2] testsuite: support mold linker To: binutils@sourceware.org References: <83618407-1683-8805-58d9-c7ac27263ddc@suse.cz> Content-Language: en-US Cc: Jan Beulich In-Reply-To: <83618407-1683-8805-58d9-c7ac27263ddc@suse.cz> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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