I would assume that 2**2
means 22, or 4 byte alignment, while 2**0
means no (one byte) alignment.
该值来自于sh_addralign
ELF 节头的字段。这ELF规范 http://www.skyfree.org/linux/references/ELF_Format.pdf状态(强调我的):
sh_addralign
某些部分具有地址对齐限制。例如,如果一个节包含一个
双字,系统必须确保整个部分的双字对齐。
也就是说,sh_addr 的值必须与 0 同余,对
sh_addralign。现在,只允许 0 和 2 的正整数幂。值 0 和 1 表示该部分没有对齐约束。
As 雷·托尔提到 https://stackoverflow.com/questions/21718388/what-does-an-algn-of-22-and-20-mean#comment32842272_21718432,由于对齐必须是 2 的幂,因此只有这样才有意义objdump
将该值表示为 2 的幂2**x
符号。
请注意,在某些语言中,例如Python http://docs.python.org/2/reference/expressions.html#the-power-operator and FORTRAN http://www.csee.umbc.edu/~squire/fortranclass/summary.shtml#Oper, **
是幂或指数运算符。
看着objdump.c http://www.opensource.apple.com/source/gdb/gdb-961/src/binutils/objdump.c, 我们看:
static void
dump_section_header (bfd *abfd, asection *section,
void *ignored ATTRIBUTE_UNUSED)
{
// ...
printf (" %08lx 2**%u", (unsigned long) section->filepos,
bfd_get_section_alignment (abfd, section));
And in objdump.h http://stuff.mit.edu/afs/sipb/project/bounds/include/bfd.h:
#define bfd_get_section_alignment(bfd, ptr) ((ptr)->alignment_power + 0)
哪里的alignment_power
成员bfd
is:
/* The alignment requirement of the section, as an exponent of 2 -
e.g., 3 aligns to 2^3 (or 8). */
unsigned int alignment_power;