Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Ulrich Weigand <uweigand@de.ibm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [rfc] Fix problem with (maybe) non-relocated .opd section on 	powerpc64-linux
Date: Thu, 15 May 2008 17:16:00 -0000	[thread overview]
Message-ID: <20080515121922.GD7597@caradoc.them.org> (raw)
In-Reply-To: <200805142302.m4EN2nHg030353@d12av02.megacenter.de.ibm.com>

On Thu, May 15, 2008 at 01:02:49AM +0200, Ulrich Weigand wrote:
> However, this is not the case if the library is loaded via dlopen.  In this
> case, the _dl_debug_state breakpoint is hit *before* relocations are applied.
> (I guess this might be considered a bug in glibc.  But we have to live with
> existing glibc's in the field anyway ...)

Not that I disagree with your conclusions, but this is a sorry state
of affairs.  There's a status field in struct r_debug; what is it when
this happens?  RT_ADD or RT_CONSISTENT?  RT_ADD is supposed to happen
before the object is added to the list, and RT_CONSISTENT after it has
been relocated.  We can end up loading inconsistent shared libraries,
if we're between those two points and someone does "info shared", but
this happens rarely and it's not the case here.

I feel like we've discussed this problem before, in one of the various
revisions of the same patch we were discussing yesterday, but I can't
find it.

> So to solve this I'm now completely ignoring contents of .opd in target
> memory, and instead always retrieve the contents from the BFD.  Those
> will certainly be non-relocated, so applying the relocation offset by
> hand will always result in the correct target address.
> 
> Is this a reasonable thing to do?

We went round the choice of where to read memory from several times on
the previous patch, but I don't know the details.


-- 
Daniel Jacobowitz
CodeSourcery


  reply	other threads:[~2008-05-15 12:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-15 12:08 Ulrich Weigand
2008-05-15 17:16 ` Daniel Jacobowitz [this message]
2008-05-15 17:40   ` Ulrich Weigand
2008-05-15 18:22     ` Daniel Jacobowitz
2008-05-15 18:56       ` Ulrich Weigand
2008-05-15 19:18         ` Ulrich Weigand
2008-05-15 19:21         ` Daniel Jacobowitz
2008-05-16 18:06           ` Ulrich Weigand
2008-05-16 20:08             ` Daniel Jacobowitz
2008-05-16 20:35               ` Pedro Alves
2008-05-17 13:22           ` Ulrich Weigand
2008-05-17 13:31             ` Daniel Jacobowitz
2008-08-14 17:16               ` Ulrich Weigand
2008-08-21 19:57                 ` Ulrich Weigand

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=20080515121922.GD7597@caradoc.them.org \
    --to=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    --cc=uweigand@de.ibm.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