1 序 言.................................................................................................................................................3
2 目标文件(Object file)......................................................................................................................3
2.1 简介.......................................................................................................................................3
2.1.1 目标文件格式............................................................................................................3
2.1.2 数据表示....................................................................................................................4
2.2 ELF Header...........................................................................................................................5
2.2.1 ELF Identification......................................................................................................6
2.2.2 机器信息....................................................................................................................8
2.3 Sections.................................................................................................................................8
2.3.1 Section Header...........................................................................................................9
2.3.1.1 Section 类型—sh_type 字段........................................................................10
2.3.1.2 sh_flags 字段................................................................................................13
2.3.1.3 sh_link 和 sh_info 字段................................................................................13
2.3.2 特殊 Sections...........................................................................................................13
2.4 String Table.........................................................................................................................16
2.5 Symbol Table.......................................................................................................................17
2.5.1 st_info 说明..............................................................................................................17
2.5.2 符号类型..................................................................................................................18
2.5.3 特殊的 Section 索引................................................................................................19
2.5.4 Symbol Values..........................................................................................................19
2.6 Relocation............................................................................................................................19
2.6.1 重定位表项..............................................................................................................20
2.6.2 重定位类型..............................................................................................................21
3 程序装载和动态链接....................................................................................................................22
3.1 简介.....................................................................................................................................22
3.2 Program Header..................................................................................................................23
3.2.1 段权限......................................................................................................................24
3.2.2 段类型......................................................................................................................24
3.2.3 基地址......................................................................................................................25
3.2.4 Note Section(注解部分).....................................................................................25
3.3 程序装载.............................................................................................................................27
3.4 动态链接.............................................................................................................................29
3.4.1 程序解释器..............................................................................................................29
3.4.2 动态链接器..............................................................................................................29
3.4.3 动态 section..............................................................................................................30
3.4.4 共享目标的依赖关系..............................................................................................32
3.5 全局偏移量表(GOT)....................................................................................................33
3.6 过程连接表(PLT)..........................................................................................................34
3.7 哈希表.................................................................................................................................36
3.8 初始化和终止函数.............................................................................................................37
4 C Library........................................................................................................................................37
4.1 关于 C 库函数.....................................................................................................................37
4.2 全局数据符号.....................................................................................................................39