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 6B4D9383F870 for ; Mon, 25 May 2020 10:02:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6B4D9383F870 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.220.254]) by mx2.suse.de (Postfix) with ESMTP id DE8D7B37F for ; Mon, 25 May 2020 10:02:47 +0000 (UTC) Date: Mon, 25 May 2020 12:02:39 +0200 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [committed][gdb/testsuite] Fix exec_is_pie with gold linker Message-ID: <20200525100237.GA6162@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=-17.7 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, 25 May 2020 10:02:47 -0000 Hi, When running test-case gdb.base/break-interp.exp with target board gold, we run into: ... gdb compile failed, pie failed to generate PIE executable ... The problem is that the proc exec_is_pie uses the PIE flag in the readelf -d output, which doesn't seem to be set by the gold linker. Instead, use the "Type" field in the readelf -h output. Tested on x86_64-linux. Committed to trunk. Thanks, - Tom [gdb/testsuite] Fix exec_is_pie with gold linker gdb/testsuite/ChangeLog: 2020-05-25 Tom de Vries PR testsuite/26031 * lib/gdb.exp (exec_is_pie): Test readelf -h output. --- gdb/testsuite/lib/gdb.exp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index f7d20bd94f..7177be941b 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -5509,11 +5509,12 @@ proc exec_is_pie { executable } { return -1 } set readelf_program [gdb_find_readelf] - set res [catch {exec $readelf_program -d $executable} output] + set res [catch {exec $readelf_program -h $executable} output] if { $res != 0 } { return -1 } - set res [regexp -line {\(FLAGS_1\).*Flags:.* PIE($| )} $output] + set res [regexp -line {^[ \t]*Type:[ \t]*DYN \(Shared object file\)$} \ + $output] if { $res == 1 } { return 1 }