This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: why the DSO was loaded at address 0
- From: Paul Pluzhnikov <ppluzhnikov at google dot com>
- To: Abin Xu <abin1525 at gmail dot com>
- Cc: libc-help at sourceware dot org
- Date: Tue, 21 May 2013 07:24:29 -0700
- Subject: Re: why the DSO was loaded at address 0
- References: <CAFcKLwhSEyMP4J-os+ZeZG0iEcq8t26=WvMpCEMVHkBJTi04pg at mail dot gmail dot com>
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