segment alignment in AMD64

Sean P. Dew freebsd.work at gmail.com
Sun Jun 28 23:42:40 UTC 2009


Hi,

Why is a loadable segment aligned to 1 MB on AMD64 while the pagezie is
still 4K for a user application. Is there anyway to change it back to 4K, It
is not making sense to me is because if my file segment is around 400K, we
are wasting 1 MB of virtual address space ( granted it is not a lot for
X64).  I am trying to find out the reason. I am posting the readelf output
of a .so. Any help is appreciated.

Thanks
Program Headers:
  Type           Offset   VirtAddr           PhysAddr           FileSiz
MemSiz   Flg Align
  LOAD           0x000000 0x0000000000000000 0x0000000000000000 0x001428
0x001428 R E 0x100000
  LOAD           0x001428 0x0000000000101428 0x0000000000101428 0x000438
0x007bd8 RW  0x100000
  DYNAMIC        0x001618 0x0000000000101618 0x0000000000101618 0x000180
0x000180 RW  0x8
  GNU_EH_FRAME   0x001420 0x0000000000001420 0x0000000000001420 0x000008
0x000008 R   0x4
 Section to Segment mapping:
  Segment Sections...
   00     .hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn
.rela.plt .init .plt .text .fini .rodata .eh_frame_hdr
   01     .data .eh_frame .dynamic .ctors .dtors .jcr .got .bss
   02     .dynamic
   03     .eh_frame_hdr


More information about the freebsd-current mailing list