Linux中ELF格式 可执行文件+动态链接器 的加载
2012-02-20 15:46
465 查看
两种加载方式
(1)加载可执行文件,通过PT_INTERP加载动态链接器
(2)直接加载动态链接器,再由其加载可执行文件
On a typical ELF system such as Linux, the kernel is normally responsible for loading both the executable and the dynamic linker. The executable is invoked by filename
with execve(). The kernel loads the executable into the process, and looks for a PT_INTERP entry in its ELF Program Headers; this specifies the filename of the dynamic linker (/lib/ld-linux.so.2 for glibc on Linux). If there is a PT_INTERP entry, the kernel
loads this file too.
Either of these two ELF objects can be relocatable (ET_DYN) or require loading at a fixed position in address space (ET_EXEC). Most often, the dynamic linker is relocatable
and the executable is fixed-position with a standard base address (0x08048000 on i386). Sometimes the executable is relocatable too (these are known as PIEs - position-independent executables). For relocatable objects, the kernel chooses the load address.
There is another way to load the two ELF objects: the dynamic linker can be invoked directly with execve(). If passed the filename of an executable, the dynamic linker
will load the executable itself.
(1)加载可执行文件,通过PT_INTERP加载动态链接器
(2)直接加载动态链接器,再由其加载可执行文件
On a typical ELF system such as Linux, the kernel is normally responsible for loading both the executable and the dynamic linker. The executable is invoked by filename
with execve(). The kernel loads the executable into the process, and looks for a PT_INTERP entry in its ELF Program Headers; this specifies the filename of the dynamic linker (/lib/ld-linux.so.2 for glibc on Linux). If there is a PT_INTERP entry, the kernel
loads this file too.
Either of these two ELF objects can be relocatable (ET_DYN) or require loading at a fixed position in address space (ET_EXEC). Most often, the dynamic linker is relocatable
and the executable is fixed-position with a standard base address (0x08048000 on i386). Sometimes the executable is relocatable too (these are known as PIEs - position-independent executables). For relocatable objects, the kernel chooses the load address.
There is another way to load the two ELF objects: the dynamic linker can be invoked directly with execve(). If passed the filename of an executable, the dynamic linker
will load the executable itself.
相关文章推荐
- ELF文件格式及程序加载执行过程总汇(3)sections
- ELF文件格式及程序加载执行过程总汇
- [置顶] ELF文件格式与动态链接/静态链接(Linux下 可执行文件的格式)
- Linux 查看 elf可执行文件格式的两个命令
- ELF文件格式及程序加载执行过程总汇(转)
- GCC & ELF文件格式 &linux内核如何加载和启动一个可执行程序
- Linux下的ELF可执行文件的格式解析
- 如何在Linux ELF格式的文件(可执行binary,以及so文件)中定位到对应的函数位置
- Linux下的ELF可执行文件的格式解析
- 浅谈Linux的可执行文件格式ELF(转帖)
- 好文转载:ELF文件格式及程序加载执行过程总汇
- Linux 查看 elf可执行文件格式的两个命令
- Linux下的ELF可执行文件的格式解析 (转)
- ELF文件格式 程序加载 执行 图示 OBJDUMP
- linux汇编之——(1)ELF:Linux可执行程序文件格式
- Linux 可执行文件 ELF结构 及程序加载运行
- ELF文件格式及程序加载执行过程总汇(1)
- Linux下ELF格式可执行文件及动态链接相关部分的解析
- ELF文件格式及程序加载执行过程总汇(2)ELF Header
- 可执行文件(ELF)格式的理解