From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id D04A13857C54 for ; Mon, 13 Jul 2020 12:15:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D04A13857C54 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id D9EB2B1CE for ; Mon, 13 Jul 2020 12:15:13 +0000 (UTC) Date: Mon, 13 Jul 2020 14:15:09 +0200 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [committed][gdb/testsuite] Handle missing gold linker in gdb.base/morestack.exp Message-ID: <20200713121507.GA31789@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jul 2020 12:15:14 -0000 Hi, When running test-case gdb.base/morestack.exp without the gold linker installed, we run into: ... Running src/gdb/testsuite/gdb.base/morestack.exp ... gdb compile failed, collect2: fatal error: cannot find 'ld' compilation terminated. FAIL: gdb.base/morestack.exp: continue === gdb Summary === nr of expected passes 1 nr of unexpected failures 1 nr of untested testcases 1 ... The test-case needs the gold linker to run correctly (as explained in commit b8d38ee425 "testsuite: Fix false FAIL for gdb.base/morestack.exp"), but only prefers it, and doesn't require it. Fix this by requiring the gold linker in the test-case. Furthermore, silence the compilation error by introducing a caching proc have_fuse_ld_gold and using it in this and other test-cases that use -fuse-ld=gold. Tested on x86_64-linux. Committed to trunk. Thanks, - Tom [gdb/testsuite] Handle missing gold linker in gdb.base/morestack.exp gdb/testsuite/ChangeLog: 2020-07-13 Tom de Vries * lib/gdb.exp (have_fuse_ld_gold): New caching proc. * gdb.base/gcore-tls-pie.exp: Use have_fuse_ld_gold. * gdb.base/gold-gdb-index.exp: Same. * gdb.base/morestack.exp: Same. --- gdb/testsuite/gdb.base/gcore-tls-pie.exp | 4 ++++ gdb/testsuite/gdb.base/gold-gdb-index.exp | 4 ++++ gdb/testsuite/gdb.base/morestack.exp | 8 ++++++-- gdb/testsuite/lib/gdb.exp | 8 ++++++++ 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/gdb.base/gcore-tls-pie.exp b/gdb/testsuite/gdb.base/gcore-tls-pie.exp index 87399abfd8..c9386c0620 100644 --- a/gdb/testsuite/gdb.base/gcore-tls-pie.exp +++ b/gdb/testsuite/gdb.base/gcore-tls-pie.exp @@ -19,6 +19,10 @@ standard_testfile +if { [have_fuse_ld_gold] == 0} { + return -1 +} + if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug additional_flags=-fpie "ldflags=-pie -fuse-ld=gold"}]} { return -1 } diff --git a/gdb/testsuite/gdb.base/gold-gdb-index.exp b/gdb/testsuite/gdb.base/gold-gdb-index.exp index e42bf439dd..22a733af39 100644 --- a/gdb/testsuite/gdb.base/gold-gdb-index.exp +++ b/gdb/testsuite/gdb.base/gold-gdb-index.exp @@ -17,6 +17,10 @@ standard_testfile .c gold-gdb-index-2.c +if { [have_fuse_ld_gold] == 0} { + return -1 +} + if {[prepare_for_testing "failed to prepare" $testfile "$srcfile $srcfile2" \ {debug c++ additional_flags=-fuse-ld=gold \ additional_flags=-Wl,--gdb-index \ diff --git a/gdb/testsuite/gdb.base/morestack.exp b/gdb/testsuite/gdb.base/morestack.exp index 2ea826c480..95ec9adc62 100644 --- a/gdb/testsuite/gdb.base/morestack.exp +++ b/gdb/testsuite/gdb.base/morestack.exp @@ -21,13 +21,17 @@ if {$gcc_compiled == 0} { return -1 } +if { [have_fuse_ld_gold] == 0} { + return -1 +} + standard_testfile # -fuse-ld=gold is used for calling printf code built without -fsplit-stack # which could crash otherwise. See GCC documentation of -fsplit-stack. set opts "additional_flags=-fsplit-stack" -if { [prepare_for_testing "failed to prepare" ${testfile} $srcfile [list $opts additional_flags=-fuse-ld=gold]] \ - && [prepare_for_testing "failed to prepare" ${testfile} $srcfile $opts] } { +if { [prepare_for_testing "failed to prepare" ${testfile} $srcfile \ + [list $opts additional_flags=-fuse-ld=gold]] } { return -1 } diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index b0faf622a9..78dae17b0c 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -7456,5 +7456,13 @@ proc gdb_note { message } { verbose -- "NOTE: $message" 0 } +# Return 1 if compiler supports -fuse-ld=gold, otherwise return 0. +gdb_caching_proc have_fuse_ld_gold { + set me "have_fuse_ld_gold" + set flags "additional_flags=-fuse-ld=gold" + set src { int main() { return 0; } } + return [gdb_simple_compile $me $src executable $flags] +} + # Always load compatibility stuff. load_lib future.exp