This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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: Relocation


Brian Blietz <bblietz@iastate.edu> writes:

> Are there any situations where ld.so will not
> get invoked when an application starts?

Yes, it will not be invoked if the application is linked statically,
via the -static option.

> What I am wondering is, will the kernel check
> the symbol table to see if it needs ld.so, or will
> it always call ld.so and let ld.so figure out it
> has nothing to do?

I think you need to read up on ELF.

The kernel never looks at the symbol table at all.  Instead, it looks
at the program headers.  First the kernel loads all the PT_LOAD
segments.  Then, if there is a PT_INTERP program header, the kernel
loads that, too, and passes the location of the program to the
interpreter in a machine dependent fashion--an array of Auxv structs
is passed somehow.  If there is no PT_INTERP program header, the
kernel just jumps to the entry address.

> It has to at least get "__libc_start_main" and "__gmon_start__" right?

The kernel doesn't care about anything like that.  Either those
symbols are present in the binary already, or the dynamic linker is
responsible for tracking them down.

Ian


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