This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: why the DSO was loaded at address 0


On Tue, May 21, 2013 at 5:06 AM, Abin Xu <abin1525@gmail.com> wrote:

> But the file "error" shows that "/lib/libc.so.6" was loaded to address 0!

No, it does not.

>      14690:    file=/lib/libc.so.6 [0];  needed by ./test [0]
>      14690:    file=/lib/libc.so.6 [0];  generating link map
>      14690:      dynamic: 0x0043cd7c  base: 0x00000000   size: 0x00191988
>      14690:        entry: 0x002c5e40  phdr: 0x002af034  phnum:         10

Presumably you are mis-interpreting base:0x00000000 is the load
address. It is not.

What it is is the relocation (difference) between linked-at address
and loaded-at address.

Usually, shared libraries are linked at address 0, and when they are,
the relocation is indeed the same as loaded-at address.  But your
libc.so.6 has been prelinked to address 0x002af000, and was loaded at
that address, giving you 0 relocation.

You can read about prelink e.g. here: http://linux.die.net/man/8/prelink

-- 
Paul Pluzhnikov


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]