First line of ld-linux.so that is called

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

First line of ld-linux.so that is called

Patrick Zou-3
looks like it is _dl_start from rtld.c. How do I confirm this?

If I do ldd on my debugged program, it shows the address of ld-linux.so.

  linux-gate.so.1 =>  (0x0052d000)
        libc.so.6 => /office/lib/libc.so.6 (0x00705000)
        /test/lib/ld-linux.so.2 (0x0083d000)


this address 0x0083d000 is not fixed, right? If load my program through
gdb, this address will be different? how to check the ld-inux.so's
address after gdb is loaded then?

thanks
patrick

Reply | Threaded
Open this post in threaded view
|

Re: First line of ld-linux.so that is called

Mike Frysinger
On Wednesday 14 February 2007, Patrick Zou wrote:
> looks like it is _dl_start from rtld.c. How do I confirm this?

ldso is set as the interp so it is executed first ... as for ldso itself, look
at the e_entry field in the elf header
-mike

attachment0 (844 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: First line of ld-linux.so that is called

Patrick Zou-3
e-entry is relative code. I want to know where this is re-positioned
after GDB loads the program image into memory.


this brings an interesting topic, how does ldd know the the position
of ld-linus.so? cause ld-linux is loaded by kernel. I guess ldd is
just bragging..


On 2/15/07, Patrick Zou <[hidden email]> wrote:

> the e_entry is a relative code, ld is loaded at different position. how to tell where it will be re-positioned from GDB?
>
>
>
>
>
> On 2/14/07, Mike Frysinger  <[hidden email]> wrote:
> > On Wednesday 14 February 2007, Patrick Zou wrote:
> > > looks like it is _dl_start from rtld.c. How do I confirm this?
> >
> > ldso is set as the interp so it is executed first ... as for ldso itself, look
> > at the e_entry field in the elf header
> > -mike
> >
> >
>
>
Reply | Threaded
Open this post in threaded view
|

Re: First line of ld-linux.so that is called

Daniel Jacobowitz-2
On Thu, Feb 15, 2007 at 04:29:57PM -0600, Patrick Zou wrote:
> this brings an interesting topic, how does ldd know the the position
> of ld-linus.so? cause ld-linux is loaded by kernel. I guess ldd is
> just bragging..

It's a sample address - ldd actually invokes ld.so in order to get
those results.

--
Daniel Jacobowitz
CodeSourcery
Reply | Threaded
Open this post in threaded view
|

Re: First line of ld-linux.so that is called

Patrick Zou-3
So, how does it work internally, ldd just displays the address of his
own ld-linux.so as a "sample"? What can we make use of this address
then?

Any way to tell where ld-so's address will be loaded from GDB?

If kernel has an algorithm to calucate which address to load for
differnt lib, this address should be stable, at least every time ldd
is trying to display it. but it is kind of changing every time I tried
to display ldd on a program.

Somewhere I read ld-linux is loaded at 0x40000000 in order to avoid
conflicting with the read program, it doesn't seem to be so true.

thanks
patrick


On 2/15/07, Daniel Jacobowitz <[hidden email]> wrote:

> On Thu, Feb 15, 2007 at 04:29:57PM -0600, Patrick Zou wrote:
> > this brings an interesting topic, how does ldd know the the position
> > of ld-linus.so? cause ld-linux is loaded by kernel. I guess ldd is
> > just bragging..
>
> It's a sample address - ldd actually invokes ld.so in order to get
> those results.
>
> --
> Daniel Jacobowitz
> CodeSourcery
>