我想知道 a与解析 ELF 文件时的.shstrtab
a 相比如何识别?.strtab
从阅读elf(5) - Linux 手册页开始,两者都属于部分标题类型SHT_STRTAB
,那么我怎么知道我遇到的是一个还是另一个?
他们的描述是:
.shstrtab
This section holds section names. This section is of type
SHT_STRTAB. No attribute types are used.
.strtab
This section holds strings, most commonly the strings that
represent the names associated with symbol table entries. If
the file has a loadable segment that includes the symbol
string table, the section's attributes will include the
SHF_ALLOC bit. Otherwise, the bit will be off. This section
is of type SHT_STRTAB.
执行时readelf file.o
,我看到以下内容:
...
[18] .strtab STRTAB 0000000000000000 00000548
0000000000000033 0000000000000000 0 0 1
[19] .shstrtab STRTAB 0000000000000000 000007a8
00000000000000a8 0000000000000000 0 0 1
所以它们在我看来是一样的,除了偏移量。