节标题结构如下所示:
typedef struct {
uint32_t sh_name;
uint32_t sh_type;
uint32_t sh_flags;
Elf32_Addr sh_addr;
Elf32_Off sh_offset;
uint32_t sh_size;
uint32_t sh_link;
uint32_t sh_info;
uint32_t sh_addralign;
uint32_t sh_entsize;
} Elf32_Shdr;
因此,您在Al
列下看到的是sh_addralign
. 让我们看一下elf 手册页中对该成员的描述:
sh_addralign
Some sections have address alignment constraints. If a
section holds a doubleword, the system must ensure
doubleword alignment for the entire section. That is, the
value of sh_addr must be congruent to zero, modulo the
value of sh_addralign. Only zero and positive integral
powers of two are allowed. Values of zero or one mean the
section has no alignment constraints.
TL;DR:列中显示的对齐约束Al
是 for Addr
(在您的情况下对齐,因为它为零),而不是 for Off
。换句话说,它是图像在内存中加载的地址的对齐约束,而不是图像在 ELF 文件中的存储位置。