From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 68509 invoked by alias); 27 Aug 2018 21:05:49 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 68489 invoked by uid 89); 27 Aug 2018 21:05:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.9 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= X-HELO: relay.fit.cvut.cz Received: from relay.fit.cvut.cz (HELO relay.fit.cvut.cz) (147.32.232.237) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 27 Aug 2018 21:05:47 +0000 Received: from imap.fit.cvut.cz (imap.fit.cvut.cz [147.32.232.238]) by relay.fit.cvut.cz (8.15.2/8.15.2) with ESMTPS id w7RL5eWj036561 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK); Mon, 27 Aug 2018 23:05:42 +0200 (CEST) (envelope-from jan.vrany@fit.cvut.cz) Received: from sao (5ac693bc.bb.sky.com [90.198.147.188] (may be forged)) (authenticated bits=0 as user vranyj1) by imap.fit.cvut.cz (8.15.2/8.15.2) with ESMTPSA id w7RL5dmm059298 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Mon, 27 Aug 2018 23:05:40 +0200 (CEST) (envelope-from jan.vrany@fit.cvut.cz) Message-ID: Subject: Re: [PATCH] Fix gdb.arch/amd64-invalid-stack-*.exp failures From: Jan Vrany To: Simon Marchi , gdb-patches@sourceware.org Date: Mon, 27 Aug 2018 21:05:00 -0000 In-Reply-To: <1fb66984-cea8-6615-9b1a-5e5df57c924d@ericsson.com> References: <20180827133803.3473-1-jan.vrany@fit.cvut.cz> <1fb66984-cea8-6615-9b1a-5e5df57c924d@ericsson.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-SW-Source: 2018-08/txt/msg00671.txt.bz2 On Mon, 2018-08-27 at 11:26 -0400, Simon Marchi wrote: > 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: > > 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] } { > > > --- > > With that, you should be able to run the test and confirm your patch works. Yes, with you patch amd64-invalid-stack-middle.exp passes here. Thanks! > 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. I'll do tomorrow. Thanks, Jan > > Thanks, > > Simon