What is p_align in elf header?

Viewed 1050

i am studying reverse engineering.

readelf something
Program Headers:
  Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
  PHDR           0x000040 0x0000000000400040 0x0000000000400040 0x0001f8 0x0001f8 R   0x8
  INTERP         0x000238 0x0000000000400238 0x0000000000400238 0x00001c 0x00001c R   0x1
      [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
  LOAD           0x000000 0x0000000000400000 0x0000000000400000 0x0006f0 0x0006f0 R E 0x200000
  LOAD           0x000e10 0x0000000000600e10 0x0000000000600e10 0x000220 0x000228 RW  0x200000
  DYNAMIC        0x000e20 0x0000000000600e20 0x0000000000600e20 0x0001d0 0x0001d0 RW  0x8
  NOTE           0x000254 0x0000000000400254 0x0000000000400254 0x000044 0x000044 R   0x4
  GNU_EH_FRAME   0x0005b4 0x00000000004005b4 0x00000000004005b4 0x00003c 0x00003c R   0x4
  GNU_STACK      0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW  0x10
  GNU_RELRO      0x000e10 0x0000000000600e10 0x0000000000600e10 0x0001f0 0x0001f0 R   0x1

in here. What does mean Align column?

i read man(5) elf.h and some docs, but i still don't know exactly it. and there are some questions about this in stack overflow but there aren't answer.

could explain it to me?

1 Answers

If you are on Linux, type man elf in your terminal and read current documentation about ELF format. The field Align in readelf output is p_align of program header. Here is part of online docs:

p_align

This member holds the value to which the segments are aligned in memory and in the file. Loadable process segments must have congruent values for p_vaddr and p_offset, modulo the page size. Values of zero and one mean no alignment is required. Otherwise, p_align should be a positive, integral power of two, and p_vaddr should equal p_offset, modulo p_align.

Related