---
title: "elf.h"
summary: "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](https://nerdcult.net/projects/noxos/docs/codebase/drivers/elf/header.h/#elf_header_t---struct)     | 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](https://nerdcult.net/projects/noxos/docs/codebase/drivers/elf/mapping.h/#elf_mapping_t---struct)* | 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](https://nerdcult.net/projects/noxos/docs/codebase/drivers/elf/elf.h/#elf_executable_t---struct).
It holds parse-time information about the elf file.

| Name                        | Type                                                                                                                | Description                                                                                                                               |
|-----------------------------|---------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------|
| executable                  | [elf_executable_T](https://nerdcult.net/projects/noxos/docs/codebase/drivers/elf/elf.h/#elf_executable_t---struct)* | A pointer to the final [elf_executable_T](https://nerdcult.net/projects/noxos/docs/codebase/drivers/elf/elf.h/#elf_executable_t---struct) |
| symbol_table                | [elf_section_T](https://nerdcult.net/projects/noxos/docs/codebase/drivers/elf/section.h/#elf_section_t---struct)*   | A pointer to `.symtab` in _buffer_                                                                                                        |
| section_header_string_table | [elf_section_T](https://nerdcult.net/projects/noxos/docs/codebase/drivers/elf/section.h/#elf_section_t---struct)*   | 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](https://nerdcult.net/projects/noxos/docs/codebase/drivers/elf/elf.h/#elf_executable_t---struct) 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_**](https://nerdcult.net/projects/noxos/docs/codebase/drivers/elf/elf.h/#elf_executable_t---struct).