From patchwork Mon Aug 27 15:26:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 29073 Received: (qmail 8986 invoked by alias); 27 Aug 2018 15:26:21 -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 8566 invoked by uid 89); 27 Aug 2018 15:26:20 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.7 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.2 spammy=lean, risky, nopie, ldflags X-HELO: sesbmg22.ericsson.net Received: from sesbmg22.ericsson.net (HELO sesbmg22.ericsson.net) (193.180.251.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 27 Aug 2018 15:26:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; d=ericsson.com; s=mailgw201801; c=relaxed/simple; q=dns/txt; i=@ericsson.com; t=1535383576; h=From:Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=IWY1QFXUUtQNTnzDi/yHW8DJD22lGlO6rx0h40K+pzc=; b=Xvfwlga6VNjBmlrNfCV5+rIV1qQ5zdiaCPYGD9mijejRlOnzOcrETpAlmRtNpgG2 sOYk35hTeZiMZ6tx+WRrv3d1XgG1rDFwpDm/FHGKzRnfScQ/24tiQiI2bm5M/ETG wiNHWq7cXoCV//jskHCQpNvLLFpjJ7SIvPQgmWCZyy8=; Received: from ESESBMB503.ericsson.se (Unknown_Domain [153.88.183.116]) by sesbmg22.ericsson.net (Symantec Mail Security) with SMTP id E3.2F.21978.818148B5; Mon, 27 Aug 2018 17:26:16 +0200 (CEST) Received: from ESESSMR504.ericsson.se (153.88.183.126) by ESESBMB503.ericsson.se (153.88.183.170) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Mon, 27 Aug 2018 17:26:16 +0200 Received: from ESESSMB504.ericsson.se (153.88.183.165) by ESESSMR504.ericsson.se (153.88.183.126) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Mon, 27 Aug 2018 17:26:15 +0200 Received: from NAM03-CO1-obe.outbound.protection.outlook.com (153.88.183.157) by ESESSMB504.ericsson.se (153.88.183.165) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3 via Frontend Transport; Mon, 27 Aug 2018 17:26:15 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KJWqrH9XLfZcwggumK08vWrwDO6deSBGhQ4PhKwUeUc=; b=kIrJji5mFpiwWUYPShryuaF56kPWS3BdOe9rqrMwK9sblOD69Ce4zbXuOxpkEhjq3uQKaqOwjKOb30Qh4tEvo3MVhNa9gSKj9Q7hwwp4TwlrN7f8UW4r5TLAMZE9YRAAh21IjW+/tIuq8nWbWWJTfP1shAskz6dd7/vd6Dl/SI8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=simon.marchi@ericsson.com; Received: from [142.133.48.188] (192.75.88.130) by DM6PR15MB2396.namprd15.prod.outlook.com (2603:10b6:5:8d::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.16; Mon, 27 Aug 2018 15:26:12 +0000 Subject: Re: [PATCH] Fix gdb.arch/amd64-invalid-stack-*.exp failures To: Jan Vrany , References: <20180827133803.3473-1-jan.vrany@fit.cvut.cz> From: Simon Marchi Message-ID: <1fb66984-cea8-6615-9b1a-5e5df57c924d@ericsson.com> Date: Mon, 27 Aug 2018 11:26:03 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180827133803.3473-1-jan.vrany@fit.cvut.cz> Return-Path: simon.marchi@ericsson.com Received-SPF: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) X-IsSubscribed: yes On 2018-08-27 09:38 AM, Jan Vrany wrote: > Commit 6d52907e226a (MI: Print frame architecture when printing frames > on an MI channel) broke amd64-invalid-stack-middle.exp and > amd64-invalid-stack-middle.exp because regexps were not updated. > > Fix it by updating regexps to accommodate new "arch" field. In the other thread, you mentioned not being able to run the -middle.exp test because of: gdb compile failed, /usr/bin/ld: /home/jv/Projects/gdb/users_jv_patches/gdb/testsuite/outputs/gdb.arch/amd64-invalid-stack-middle/amd64-invalid-stack-middle0.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC That's probably because you have a "recent" toolchain that tries to build PIE executables by default. However, the assembly file has been generated without the position-independent code switch (-fPIC), so it includes code that can't end up in a position-independent executable. I see 3 solutions: 1. Re-generate the file using the command in amd64-invalid-stack-middle.S, but with -fPIC. That's a bit risky, because we need to make sure the new compiler emits code that would trigger the same bug the test has been written for. 2. Manually change amd64-invalid-stack-middle.S to remove things relying on .rodata. That may be a bit tedious and risky too. 3. Add the -no-pie linker switch to force generating position-dependent executables. Solution #3 is easy and safe, so I would lean towards that, it's a one-liner: --- With that, you should be able to run the test and confirm your patch works. It does fix the failures when I run it locally, and the patch LGTM. If you want to make a proper patch to add the -no-pie flag, you are welcome to. Thanks, Simon diff --git a/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp b/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp index c00bfa10bd1b..b17eea59edc2 100644 --- a/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp +++ b/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp @@ -27,7 +27,7 @@ # run twice, and we restart gdb before testing each different command to # ensure that nothing is being cached. -set opts {} +set opts {ldflags=-no-pie} standard_testfile .S if { ![istarget x86_64-*-* ] || ![is_lp64_target] } {