public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Jan Vrany <jan.vrany@fit.cvut.cz>
To: Simon Marchi <simon.marchi@ericsson.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix gdb.arch/amd64-invalid-stack-*.exp failures
Date: Mon, 27 Aug 2018 21:05:00 -0000	[thread overview]
Message-ID: <e05e99a67d48811f863e90fcb1fa40ed5bcd4f48.camel@fit.cvut.cz> (raw)
In-Reply-To: <1fb66984-cea8-6615-9b1a-5e5df57c924d@ericsson.com>

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

      reply	other threads:[~2018-08-27 21:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-27 13:38 Jan Vrany
2018-08-27 15:26 ` Simon Marchi
2018-08-27 21:05   ` Jan Vrany [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e05e99a67d48811f863e90fcb1fa40ed5bcd4f48.camel@fit.cvut.cz \
    --to=jan.vrany@fit.cvut.cz \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@ericsson.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).