Determine the full address space of a loaded ELF binary.
Defined in <mojoelf.h>
void MOJOELF_getmmaprange(void *lib, void **addr, unsigned long *len);| void * | lib | a handle from a MojoELF-opened ELF binary. |
| void ** | addr | on return, contains the mmap'd base address for
lib. |
| unsigned long * | len | on return, set to the number of bytes mmap'd for
lib. |
An ELF binary is loaded to specific addresses with mmap(). This function returns the starting address of that mapped range, and the number of bytes mapped. This tells you the block of memory that the the ELF is occupying.
What is at a specific address in that memory block, whether it is code or data, and what memory protections any given page has, are not guaranteed. It is not a copy of the ELF binary, but different sections of it mapped as specified in the original binary.
Most applications don't need to use this function.
this function is not thread-safe.
This function is available since MojoELF 1.0.0.