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: libc.so, dynamic and executable?


On Monday 12 May 2008, Ryan Arnold wrote:
> On Mon, May 12, 2008 at 10:19 AM, Nathan Weyer <nathanw@meritind.com> wrote:
> > Well, the list said any question....
> >
> >  I am curious if anyone can explain how glibc manages the trick of being
> > both a executable binary and a loadable module at the same time? I was
> > under the impression that dlopen didn't work on anything that could run
> > on it's own.
>
> Which application and/or library provided by GLIBC are you referring to?

well only one file in glibc is like this ...

> When a user application is compiled it has the program interpreter
> (the dynamic linker/loader ld.so) information [the path] embedded in
> the program's ELF header.

your use of "ELF header" is kind of loose here.  the interpeter is not set in 
the ELF header structure (ehdr).  it's a dedicated ELF program header 
(PT_INTERP / phdr).

> As far as I understand, the kernel loads the application and the
> indicated dynamic linker/loader into memory.  It passes control to the
> loader which will load the libc.so library and resolve necessary early
> symbols.  Control will pass to libc to execute the application init
> code which will launch the application.

the loader doesnt special case any library.  it loads all libraries specified 
by the DT_NEEDED dynamic headers of the ELF (which is passed to the ldso).
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.


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