2.ELF之Section Header
SH
- elf.h
此处为每个Section Entry的结构。
- 对应关系
foo.c
foo.o
这里可以看到,SH从1168 = 0x490,每个entry40B,23个entry,其中第20个是string section。
1.Name: string table index
.shstrtab中存储所有section 的名称(ASCII码存储),用“.”分隔。这样一来,每个Section Entry中的name只需要存放该section的名称是从.shstrtab的第几个字符开始。
2.Type:
NULL unused
PROGBITS program data
NOBITS program space with no data(bss)
REL relocation entries, no addends
ARM_EXIDX arm unwind section
ARM_ATTRIBUTES arm attributes section
与具体架构ARM相关的section
STRTAB string table,字符串表,变量名,函数名等。
SYMTAB symbol table,符号表,变量,函数等。
3.Addr: section virtual address at execution
当前文件为.o REL 文件,未组装进可执行文件,所以没有虚拟地址与之对应。
4.Off: section file offset
此值从小到大可以看到section在当前文件中的排列顺序。
5.Size: section size
6.ES: entry size if section holds table
如若该section是一个table,table中每个项目的大小是多大。比如Relocation Section中,8B正好是两个地址的大小,一个填充位置,一个填充数据(也是地址)。
7.Flg: section flags
8.Lk: link to another section
此处为十进制表示,表示当前section依赖于某一section。
9.Inf: additional section information
若不为0,表示当前section是某一section的重定位section。
10.Al: section alignment
Sections:
- NULL
- text 代码
- data 数据
- bss 初始为0的数据
- ARM.extab ARM exception数据
- ARM.exidx ARM exception数据(详见exception)
- rel.ARM.exidx 上一section的重定位section
绿色字体为exception异常处理信息。
- debug_info
- rel.debug_info
- debug_abbrev
- debug_aranges
- rel.debug_arranges
- debug_line
- rel.debug_line
- debug_str
蓝色字体都为debug信息。
- comment
- note.GNU-stack
栈,大小为0;
- ARM.attributes
- debug_frame
- rel.debug_frame
- shstrtab
section header string table
- symtab
symbol table
- strtab
string table
浙公网安备 33010602011771号