documentation/kernel/drivers/elf/elf.h.md

2.4 KiB

elf.h

The ELF-parsers' heart.

elf_executable_T - struct

This struct holds the parsed data of an ELF executable.

Name Type Description
header elf_header_T The header of the elf file
num_symbols uint64_t The size of symbols
symbols symbol_T* An array containing all symbols of the elf file
num_mappings uint64_t The size of mappings
mappings elf_mapping_T* An array containing the mappings needed to load the elf file
string_table void* A copy of the elf files .strtab section, all strings are referenced here to have them available even if the elf file is closed

elf_executable_temp_T - struct

This struct is used while generating an elf_executable_T. It holds parse-time information about the elf file.

Name Type Description
executable elf_executable_T* A pointer to the final elf_executable_T
symbol_table elf_section_T* A pointer to .symtab in buffer
section_header_string_table elf_section_T* A pointer to .shstrtab in buffer
buffer uint8_t* The buffer where the executable is loaded from

elf_executable_create(buffer) - function (elf_executable_T*)

Generates an elf_executable_T from an elf file loaded to buffer and returns a pointer to it.

elf_executable_destruct(executable) - function (void)

Frees all memory allocated for executable.