This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [patch] Fix l_addr comment
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Fri, 30 Sep 2011 17:11:14 +0200
- Subject: Re: [patch] Fix l_addr comment
- References: <20110930144139.GA26630@host1.jankratochvil.net>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Fri, Sep 30, 2011 at 04:41:39PM +0200, Jan Kratochvil wrote:
> there is confusion what does l_addr mean as on systems without prelink it has
> the value which the comment describes. But with prelink it is not the case:
>
> (gdb) p *_r_debug.r_map.l_next.l_next
> $5 = {l_addr = 0, l_name = 0x7ffff7ffd740 "/lib64/libreadline.so.6", l_ld = 0x3f1d83bf90, l_next = 0x7ffff7fd3000, l_prev = 0x3f15420818}
> ^
Not sure if talking about prelink there is desirable, l_addr
is simply a load bias, difference between l_map_start and first
PT_LOAD segment's virtual address in the ELF file.
> 2011-09-30 Jan Kratochvil <jan.kratochvil@redhat.com>
>
> * elf/link.h (struct link_map): Extend the l_addr comment.
> * include/link.h (struct link_map): Likewise.
>
> --- a/elf/link.h
> +++ b/elf/link.h
> @@ -87,7 +87,12 @@ struct link_map
> /* These first few members are part of the protocol with the debugger.
> This is the same format used in SVR4. */
>
> - ElfW(Addr) l_addr; /* Base address shared object is loaded at. */
> + ElfW(Addr) l_addr; /* Base address shared object is loaded at
> + minus where the object is prelinked to.
> + For successfully prelinked objects it is 0,
> + for non-prelinked objects it is its base
> + address. It can be also anything else for
> + prelinked objects loaded elsewhere. */
> char *l_name; /* Absolute file name object was found in. */
> ElfW(Dyn) *l_ld; /* Dynamic section of the shared object. */
> struct link_map *l_next, *l_prev; /* Chain of loaded objects. */
> --- a/include/link.h
> +++ b/include/link.h
> @@ -88,7 +88,12 @@ struct link_map
> /* These first few members are part of the protocol with the debugger.
> This is the same format used in SVR4. */
>
> - ElfW(Addr) l_addr; /* Base address shared object is loaded at. */
> + ElfW(Addr) l_addr; /* Base address shared object is loaded at
> + minus where the object is prelinked to.
> + For successfully prelinked objects it is 0,
> + for non-prelinked objects it is its base
> + address. It can be also anything else for
> + prelinked objects loaded elsewhere. */
> char *l_name; /* Absolute file name object was found in. */
> ElfW(Dyn) *l_ld; /* Dynamic section of the shared object. */
> struct link_map *l_next, *l_prev; /* Chain of loaded objects. */
Jakub