Closed vinaychandra closed 3 years ago
The allocate
function is called for every program header of type LOAD
.
load
will not be called for something like bss
so the client has to ensure the memory is zeroed in allocate
. The idea is that allocate
reserves the memory and zeroes it and load
fills in the relevant regions (.text, etc).
The easiest thing to visualize what happens is probably to run readelf --program-headers
on the binary you're trying to load and then cross-reference the information there with the actual calls to the elfloader trait when loading said binary.
How are
bss
sections loaded? Justallocate
is called or isload
also called with zero values? The reason is that zeroing of memory is not needed in case load is called.Can you please call this out in docs / examples?