Re: how does ld.so call ELF's entry?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



from 'man exeve':
if the executable is a dynamically linked ELF  executable,  the
interpreter named in the PT_INTERP segment is used to load the needed
shared libraries.  This interpreter is typically /lib/ld-linux.so.1
for  binaries  linked  with the Linux libc 5, or /lib/ld-linux.so.2
for binaries linked with the glibc 2.
If you really want to know what really happens then go to dig the
exec.c source of linux:
http://lxr.linux.no/#linux+v3.8.6/fs/exec.c and binfmt*.c. If you
follow the process you will find how the loader find, parse, and
handle the interpretor.

regards,

Sofiane Akermoun

2013/4/7 ishare <june.tune.sea@xxxxxxxxx>:
> On Sun, Apr 07, 2013 at 05:11:28AM +0200, Sofiane Akermoun wrote:
>> Hello,
>>
>>
>> The interpreter is specified during linking process and the program header
>> of your binary is filled with good values.
>> Then when the operating system load your binary, he finds next the
>> interpreter to use.
>> The linker ld sets the good values by default but you can overwrite it or
>> specify other values if you want.
>> The steps are:
>> 1)The operating system loads your binary
>> 2)The program loader system execute the Interpreter specifiy in the binary
>> 3)The interpreter gather all the dynamic libraries needed in memory
>
>
>> 4)The Control is passed to the entry point of your program
>
>   How does  the step 4 been  done ?
>
>   thanks!
>>
>> The entry point is specified in your code source as a "global". And could
>> be find in your object file by the linker.
>> In theory there are some default tag to specify entry point, like "..start"
>> for nasm, but you can also passed it to the linker.
>>
>> regards,
>>
>> Sofiane Akermoun
>> akersof@xxxxxxxxx
>>
>>
>>
>>
>>
>> 2013/4/7 ishare <june.tune.sea@xxxxxxxxx>
>>
>> >
>> >   For an ELF ,which needs a interpreter , how is it  been called by the
>> > interpreter ?
>> >
>> >   As I know the interpreter is loaded first and do something essential
>> > ,then call the main routine of ELF .
>> >   How is this procedure implemented ?
>> >
>> >   Thanks!
>> > --
>> > To unsubscribe from this list: send the line "unsubscribe linux-assembly"
>> > in
>> > the body of a message to majordomo@xxxxxxxxxxxxxxx
>> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> >
>>
>>
>>
>> --
>> Sofiane AKERMOUN
>> akersof@xxxxxxxxx



-- 
Sofiane AKERMOUN
akersof@xxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Newbies]     [Security]     [Linux C Programming]     [Linux for Hams]     [DCCP]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux