From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Cc: Daniel Jacobowitz <dan@codesourcery.com>
Subject: Re: [patch] svr4_exec_displacement success indicator [Re: PIE question]
Date: Fri, 12 Mar 2010 15:31:00 -0000 [thread overview]
Message-ID: <20100312153138.GB13120@host0.dyn.jankratochvil.net> (raw)
In-Reply-To: <20100308215913.GB2629@caradoc.them.org>
On Mon, 08 Mar 2010 22:59:13 +0100, Daniel Jacobowitz wrote:
> On Mon, Mar 08, 2010 at 10:53:58PM +0100, Jan Kratochvil wrote:
> > OK to check-in?
>
> Yes, these are OK. [Sorry, should have checked this folder first.]
-> http://sourceware.org/ml/gdb-cvs/2010-03/msg00097.html
# 2010-03-10 Jan Kratochvil <jan.kratochvil@redhat.com>
# +
# + * solib-svr4.c (svr4_exec_displacement): Return now success, new
# + parameter displacementp. Update comment.
# + (svr4_relocate_main_executable): Return if non-zero SECTION_OFFSETS
# + element exists. Return if svr4_exec_displacement was not successful.
# + Update comment.
Is it OK also for gdb_7_1-branch?
Otherwise the minimized attached patch also works for me. Still I would
prefer the full patch from the master branch.
No regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu.
Thanks,
Jan
gdb/
2010-03-12 Jan Kratochvil <jan.kratochvil@redhat.com>
* solib-svr4.c (svr4_relocate_main_executable): Delay the
svr4_exec_displacement call. Return on non-DYNAMIC exec_bfd.
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -1719,7 +1719,15 @@ svr4_exec_displacement (void)
static void
svr4_relocate_main_executable (void)
{
- CORE_ADDR displacement = svr4_exec_displacement ();
+ CORE_ADDR displacement;
+
+ /* Therefore for ELF it is ET_EXEC and not ET_DYN. Both shared libraries
+ being executed themselves and PIE (Position Independent Executable)
+ executables are ET_DYN. */
+ if (exec_bfd && (bfd_get_file_flags (exec_bfd) & DYNAMIC) == 0)
+ return;
+
+ displacement = svr4_exec_displacement ();
/* Even if DISPLACEMENT is 0 still try to relocate it as this is a new
difference of in-memory vs. in-file addresses and we could already
next prev parent reply other threads:[~2010-03-12 15:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20100307005326.GA29245@caradoc.them.org>
[not found] ` <20100308213744.GA16628@host0.dyn.jankratochvil.net>
2010-03-08 21:54 ` Jan Kratochvil
2010-03-08 21:59 ` Daniel Jacobowitz
2010-03-10 21:01 ` Jan Kratochvil
2010-03-12 15:31 ` Jan Kratochvil [this message]
2010-03-12 15:39 ` Daniel Jacobowitz
2010-03-14 6:46 ` Joel Brobecker
2010-03-14 8:56 ` Jan Kratochvil
2010-03-25 22:44 ` [patch] PIE: Fix back re-run [Re: [patch] svr4_exec_displacement success indicator] Jan Kratochvil
2010-03-29 11:09 ` [cancel] " Jan Kratochvil
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=20100312153138.GB13120@host0.dyn.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=dan@codesourcery.com \
--cc=gdb-patches@sourceware.org \
/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).