ElfFileOpenFromMemory
Description
Parse an ELF object from an in-memory byte range. The data buffer is borrowed — the caller must keep it alive for the lifetime of the returned ElfFile.
Parameters
| Name | Direction | Description |
|---|---|---|
out |
out | Populated on success. |
data |
in | Raw ELF bytes. Borrowed; not copied. |
data_size |
in | Length of data in bytes. |
alloc |
in | Allocator for the section / symbol vectors. |
Success
Returns true; out->owns_data is false.
Failure
Returns false; logs the failing step. out is left zeroed.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Elf.c:313:
// ---------------------------------------------------------------------------
bool ElfFileOpenFromMemory(ElfFile *out, u8 *data, size data_size, Allocator *alloc) {
if (!out || !data || !alloc) {
LOG_ERROR("ElfFileOpenFromMemory: NULL argument");- In
Elf.c:315:
bool ElfFileOpenFromMemory(ElfFile *out, u8 *data, size data_size, Allocator *alloc) {
if (!out || !data || !alloc) {
LOG_ERROR("ElfFileOpenFromMemory: NULL argument");
return false;
}- In
Elf.c:353:
}
if (!ElfFileOpenFromMemory(out, (u8 *)buf, (size)bytes, alloc)) {
AllocatorFree(alloc, buf, capacity);
return false;
Last updated on