From: Simon Marchi <simon.marchi@ericsson.com>
To: Jan Vrany <jan.vrany@fit.cvut.cz>, <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Fix gdb.arch/amd64-invalid-stack-*.exp failures
Date: Mon, 27 Aug 2018 15:26:00 -0000 [thread overview]
Message-ID: <1fb66984-cea8-6615-9b1a-5e5df57c924d@ericsson.com> (raw)
In-Reply-To: <20180827133803.3473-1-jan.vrany@fit.cvut.cz>
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.
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
next prev parent reply other threads:[~2018-08-27 15:26 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 [this message]
2018-08-27 21:05 ` Jan Vrany
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=1fb66984-cea8-6615-9b1a-5e5df57c924d@ericsson.com \
--to=simon.marchi@ericsson.com \
--cc=gdb-patches@sourceware.org \
--cc=jan.vrany@fit.cvut.cz \
/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).