I have an ELF header like this:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x002dd0 0x0000000000003dd0 0x0000000000003dd0 0x000250 0x000258 RW 0x1000
Which is supposed to map these sections:
.init_array .fini_array .dynamic .got .got.plt .data .bss
When I do readelf -l program
I can see that this section indeed begin with address 0x002dd0
:
Section Headers:
[Nr] Name Type Address Off Size ES Flg Lk Inf Al
(...)
[20] .init_array INIT_ARRAY 0000000000003dd0 002dd0 000008 08 WA 0 0 8
[21] .fini_array FINI_ARRAY 0000000000003dd8 002dd8 000008 08 WA 0 0 8
[22] .dynamic DYNAMIC 0000000000003de0 002de0 0001e0 10 WA 7 0 8
[23] .got PROGBITS 0000000000003fc0 002fc0 000028 08 WA 0 0 8
[24] .got.plt PROGBITS 0000000000003fe8 002fe8 000028 08 WA 0 0 8
[25] .data PROGBITS 0000000000004010 003010 000010 00 WA 0 0 8
[26] .bss NOBITS 0000000000004020 003020 000008 00 WA 0 0 1
But when I launch the process and look the pmap
output, it shows that this segment offset starts at 0x003000
instead of 0x002dd0
:
Address Perm Offset Inode Size Rss Anonymous Mapping
63a2b2ccb000 rw-p 00003000 5243856 4 4 4 program
Why is that? If it starts at 0x003000
, is it not missing data in 0x002dd0-0x002fff
range?