LOAD segment in ELF

Programming, for all ages and all languages.
Post Reply
User avatar
ASMMan
Posts: 14
Joined: Fri Jan 18, 2013 10:35 pm

LOAD segment in ELF

Post 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.
User avatar
ASMMan
Posts: 14
Joined: Fri Jan 18, 2013 10:35 pm

Re: LOAD segment in ELF

Post 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.
Post Reply