这个ELF 文件用作不同用途,文件结构的解析角度就有点不一样,通俗来说,不同用途对需要哪些数据的要求不一样,例如构建(链接)时 节表头(Section Table Header)是必须的,但运行时却是可选的,例如运行需要段信息,而链接只有节信息。 在上图中,程序头表(ProgramHeader Table)紧跟在 ELF 文件头(File Header)之后,节...
把库编译成内存位置无关会带来一些花费,编译器会保留一个寄存器来指向全局偏移量表(global offset table (or GOT for short)),这就会导致编译器在优化代码时少了一个寄存器可以使用,但是在最坏的情况下这种性能的减少只有3%,在其他情况下是大大小于3%的。 Elf的另一个特点是它的动态连接库是在运行时处理符号的,...
Unix系统里的两种重要的格式:a.out和elf(Executable and Linking Format)。 这两种格式中都有符号表(symbol table),其中包括所有的符号(程序的入口点还有变量的地址等等)。在elf格式中符号表的内容会比a.out格式的丰富的多。但是这些符号表可以用 strip工具去除,这样的话这个文件就无法让debug程序跟踪了,但是会生成...
--symbols An alias for --syms --dyn-syms Display the dynamic symbol table -n--notes Display the core notes (if present) -r--relocs Display the relocations (if present) -u--unwind Display the unwind info (if present) -d--dynamic Display the dynamic section (if present) -V--version-...
02 .interp .note.ABI-tag .note.gnu.build-id .hash .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .plt .text .fini .rodata .eh_frame_hdr .eh_frame 03 .ctors .dtors .jcr .dynamic .got .got.plt .data .bss ...
SHT_GNU_verdef0x6ffffffd/* Version definition section. */#define SHT_GNU_verneed0x6ffffffe/* Version needs section. */#define SHT_GNU_versym0x6fffffff/* Version symbol table. */#defineSHT_HISUNW0x6fffffff/* Sun-specific high bound. */#defineSHT_HIOS0x6fffffff/* End OS-specific ...
.strtab(string table),存储全局成员(symbol)的名称,对程序进行调试和反汇编时看见的数据名由此节记录,使用gcc编译程序时可以添加-s参数不保留这些数据名。对于C语言程序,此节记录的是数据名原型,对于C++程序,此节记录的并非原始数据名,因为C++支持函数重载、符号重载、虚拟类型、命名空间,导致多个数据可以同名,编译器...
Section header string table index: 27 $readelf -h libtest.so 共享库 ELF Header: Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 Class: ELF64 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ...
程序头表:program header table 程序解析器:program interpreter 重定位:relocation 共享目标:shared object 区(节):section 区(节)头:section header 区(节)表:section header table 段:segment 字符串表:string table 符号表:symbol table 终止函数:termination function ...
`-- symbol |-- 1.sh |-- app.c |-- include | |-- __elf.h | |-- compiler.h | `-- version.h `-- parser.c app.c、compiler.h、__elf.h,以及 parser.c 的部分函数 在 方案1 和 方案2 中是通用的,为不影响行文的连贯性,这部分代码直接贴在第 6 章。