Page 1 of 1

LOAD segment in ELF

Posted: Wed Apr 09, 2014 2:33 pm
by ASMMan
The second PT_LOAD segment that's the .data + .bss (assume it's the order of sections) sections "together". sizes p_filesiz and p_memsiz are requested and the kernel is up to allocate p_memsiz bytes and zero the difference between p_memsiz and p_filesiz ie.,

Code: Select all

 N = p_memsiz - p_filesiz
and N is the .bss memory region now filled by zeroes. How does this allocation actually works? the kernel allocate p_memsiz and put the begging of this block memory on p_vaddr so that the write/read memory region of this segment is from p_vaddr up to p_vaddr + p_memsiz ? I hope it's clear.

Re: LOAD segment in ELF

Posted: Thu Apr 10, 2014 2:58 pm
by ASMMan
I figure it out. In case of someone has same doubt: it's in p_vaddr value. For dynamic object, the only change it's may be in any arbitrary address set up by the kernel/linker instead of explicitly one fixed in file itself.