From patchwork Wed Aug 14 15:14:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 34087 Received: (qmail 27444 invoked by alias); 14 Aug 2019 15:14:16 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 27369 invoked by uid 89); 14 Aug 2019 15:14:12 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 14 Aug 2019 15:14:11 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id DFC7FABC6 for ; Wed, 14 Aug 2019 15:14:08 +0000 (UTC) Date: Wed, 14 Aug 2019 17:14:07 +0200 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH][gdb/testsuite] Fix compare-sections.exp with -fPIE/-pie Message-ID: <20190814151405.GA22804@delia> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-IsSubscribed: yes Hi, When running gdb.base/compare-sections.exp with target board -fPIE/-pie, we get: ... FAIL: gdb.base/compare-sections.exp: after run to main: compare-sections -r ... The test expects the read-only sections to have the same contents as in the file: ... # Assume startup code doesn't change read-only sections. compare_sections "-r" ... but that's not the case for PIE executables. Fix this by allowing mismatched read-only sections for PIE executables. Tested on x86_64-linux. OK for trunk? Thanks, - Tom [gdb/testsuite] Fix compare-sections.exp with -fPIE/-pie gdb/testsuite/ChangeLog: 2019-08-14 Tom de Vries * gdb.base/compare-sections.exp ("after run to main"): Allow mismatched read-only sections for PIE executables. --- gdb/testsuite/gdb.base/compare-sections.exp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/gdb.base/compare-sections.exp b/gdb/testsuite/gdb.base/compare-sections.exp index 7dbae5b2c2..75667ee25c 100644 --- a/gdb/testsuite/gdb.base/compare-sections.exp +++ b/gdb/testsuite/gdb.base/compare-sections.exp @@ -21,6 +21,8 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug}]} { return -1 } +set is_pie [exec_is_pie $binfile] + # Run the compare-sections command along with any options as specified # by OPTIONS, and check that no mismatch is found. proc compare_sections { {options ""} } { @@ -87,8 +89,13 @@ with_test_prefix "after run to main" { gdb_test "compare-sections" \ "MIS-MATCHED.*warning.*One or more sections.*does not match.*loaded file" - # Assume startup code doesn't change read-only sections. - compare_sections "-r" + if { $is_pie == 1 } { + gdb_test "compare-sections -r" \ + "MIS-MATCHED.*warning.*One or more sections.*does not match.*loaded file" + } else { + # Assume startup code doesn't change read-only sections. + compare_sections "-r" + } } # Now test that "compare-sections -r" works as expected. Look for an