Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: James Cownie <jcownie@etnus.com>
Cc: libc-alpha@sources.redhat.com, binutils@sources.redhat.com,
	gdb@sources.redhat.com
Subject: Re: RFC: ELF prelinker - 0.1.1
Date: Thu, 05 Jul 2001 05:02:00 -0000	[thread overview]
Message-ID: <20010705080214.O32061@devserv.devel.redhat.com> (raw)
In-Reply-To: <15I7Lu-0j2-00@etnus.com>

On Thu, Jul 05, 2001 at 12:31:22PM +0100, James Cownie wrote:
> > I have to. Debugger relocates them too, but debugger relocates them
> > by adding link_map->l_addr, which is load address, not base address.
> > Load address is the difference between actual virtual addresses in
> > library and virtual addresses stored in the library.
> 
> Ahh, so the point is that l_addr is zero for a pre-linked library in
> the good case, or the offset of where you have to place the pre-linked
> library from where you pre-linked it to in the bad case.
> 
> So you are right, the debugger won't do any relocation for you (well,
> it will, but adding zero doesn't achieve anything !).
> 
> Previously (when shared libraries were all linked as though they would
> be loaded at zero), l_addr _was_ the base address of the library.
> 
> After all, l_addr is declared like this :-
>     ElfW(Addr) l_addr;		/* Base address shared object is loaded at.  */

But glibc's private link.h has this comment for a long time:
    /* Start and finish of memory map for this object.  l_map_start
       need not be the same as l_addr.  */
    ElfW(Addr) l_map_start, l_map_end;

Anyway, from my initial look at DWARF2, DWARF2 relocation will be fairly
easy as that format is nicely designed. Nothing in LEB128 format needs to be
relocated, essentially:
- nothing in .debug_abbrev
- don't have to care about .eh_frame, since it is SHF_ALLOC and has its REL{,A} section
- no addresses which need relocation, can be in LEB128 format (how would
  static linker work in that case?), there is nothing like R_IA64_ULEB128,
  is it? From my current brief look at DWARF2, DW_FORM_addr format
  attributes will have to be adjusted, plus DW_OP_addr's, will need to check
  some more if I haven't missed something
- will need to figure out what to do about the rest of .debug_* sections -
  but the prelinker will certainly just bail out if it finds a debug section
  or its format which it does not recognize.

	Jakub


  reply	other threads:[~2001-07-05  5:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20010705125600.Q737@sunsite.ms.mff.cuni.cz>
2001-07-05  4:31 ` James Cownie
2001-07-05  5:02   ` Jakub Jelinek [this message]
2001-07-05  6:08     ` James Cownie
2001-07-05  8:42     ` Daniel Berlin

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=20010705080214.O32061@devserv.devel.redhat.com \
    --to=jakub@redhat.com \
    --cc=binutils@sources.redhat.com \
    --cc=gdb@sources.redhat.com \
    --cc=jcownie@etnus.com \
    --cc=libc-alpha@sources.redhat.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