From patchwork Mon Dec 5 12:10:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 29662 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2210060wrr; Mon, 5 Dec 2022 04:10:20 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Ep09JuHHDLEq5yMItgI35jBspVAxokCKJ1fqNnJtcca7azV0glHcvsWxFoPI6MoZCP9s6 X-Received: by 2002:a05:6402:4286:b0:458:7489:34ea with SMTP id g6-20020a056402428600b00458748934eamr3863269edc.264.1670242220246; Mon, 05 Dec 2022 04:10:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670242220; cv=none; d=google.com; s=arc-20160816; b=UDiN9Ub/0YLYaphtOybQW/kWldDc6w9gShkpqgpqWUTFhalQzCSIhDpPz2pg+vj7e2 UEfAX3nTe6zcVOekIlu3GEhlYOgI7DXJN0VdpvN3T6VsOzOuWkq+fpszzKFbYut3Fotz Ba58ysiknqkWxd56FZY0QzVjW0+7t+qcMZOhlXnxUc4sbG+tgsa4HJDO7pr/3eeNSOaA Kf+7jsTtHB4WkAYTcV6hXHbeH8AIzeQfcGF4xVHSI5RvAmtmWGrxK5pOdcjHcn5/eUi6 NNvsacX1/MS1au10kcDaA1M0H+yYPihA8EW77Lddl+P/9qdOgT1uQ2gSuFJ9ePU24/Um Wrzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :content-language:to:subject:from:user-agent:mime-version:date :message-id:dkim-signature:dkim-signature:dmarc-filter:delivered-to; bh=S+WQhRawuppieS5OctHPVim7ZCToPDzAHPWJqghEzgI=; b=Ihck3/rRq0aUtvaP1/va1G4t30Qt6Cs7anec/sUfMmctJwQO6A5ZR2iif49+hz/DKn W8dGLr5Z8kaK4wHYNC8nqLXQwzA2rI9DqeBf2wkamK0KxF2z4d2FEm609LTN3FMmnwWo z8t7lCqmAqYwCeD5v+idQ4F1G/k4G/2382uW7A5OOMQtUEfQ2TkLd0fbcJJAZw8FkUCn 1TCsFL3lmwqKd7yoXNhWSCXQAWpUQM5F1IaDmMb/OjH+ywS/iza0ZY5IpuMcLOWNBmWQ St3l7gy1pNTUoRcaVI6Vfkqo2MRZQatg4MoCA1SHMwPMqPuQ3rWO80HPHgFfPT9D0oea QczA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=Qy3a+U72; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=mK3uWBSZ; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id q24-20020aa7d458000000b0045c26f0050esi10901860edr.238.2022.12.05.04.10.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 04:10:20 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=Qy3a+U72; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=mK3uWBSZ; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D42C0389941C for ; Mon, 5 Dec 2022 12:10:18 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id 577C73894C14 for ; Mon, 5 Dec 2022 12:10:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 577C73894C14 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=fail 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 65F7A1FEBD for ; Mon, 5 Dec 2022 12:10:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1670242211; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=S+WQhRawuppieS5OctHPVim7ZCToPDzAHPWJqghEzgI=; b=Qy3a+U72b/kMYtg1mLZp46t2F3LEYtEELfGI4CkmAaN3918Z4xe/nrvocY9uqBm5zl4HJu Yh3J9m2Pv6iwXAaCN8xpqjhpnpxOnLxIEV9Mzj+5Ve0BzFnHFzceSzxJOpEWnjamQnAtnE iU+dMPfjG4Pxa6h7lWgShALw2/IOYc4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1670242211; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=S+WQhRawuppieS5OctHPVim7ZCToPDzAHPWJqghEzgI=; b=mK3uWBSZ7jRfnvSGW8oudCS81oy6iVfn/S/eNvzzzsVtpNS8Us930cHVknx8dQs0uBWsGQ pGg7G4ytQOryQeCA== 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 5978313326 for ; Mon, 5 Dec 2022 12:10:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id B7t/FKPfjWMuRAAAGKfGzw (envelope-from ) for ; Mon, 05 Dec 2022 12:10:11 +0000 Message-ID: <76253e84-a7c3-5d09-c6a7-422573ca2d37@suse.cz> Date: Mon, 5 Dec 2022 13:10:10 +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] testsuite: support mold linker To: binutils@sourceware.org Content-Language: en-US X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_SOFTFAIL, 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 X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751375906601750942?= X-GMAIL-MSGID: =?utf-8?q?1751375906601750942?= Mold linker demotes symbols like main to be local and the patch adjusts expected output from nm. Ready to be installed? Thanks, Martin --- binutils/testsuite/binutils-all/addr2line.exp | 4 ++-- binutils/testsuite/binutils-all/objcopy.exp | 8 ++++---- libbacktrace/Makefile.am | 2 +- libbacktrace/Makefile.in | 2 +- 4 files changed, 8 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..9288506eee7 100644 --- a/binutils/testsuite/binutils-all/objcopy.exp +++ b/binutils/testsuite/binutils-all/objcopy.exp @@ -652,8 +652,8 @@ 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]+)?[ ]+[tTD] main} $exec_output] \ + && ![regexp {^([0-9a-fA-F]+)?[ ]+[tT] _main} $exec_output]} { fail $test return } @@ -902,8 +902,8 @@ 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]+)?[ ]+[TtD] main} $exec_output] \ + && ![regexp {^([0-9a-fA-F]+)?[ ]+[TtD] _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