This repository has been archived on 2023-09-28. You can view files and clone it, but cannot push or open issues or pull requests.
homepage/content/projects/noxos/docs/codebase/drivers/elf/segment.h.md

30 lines
2.5 KiB
Markdown
Raw Normal View History

---
title: "segment.h"
summary: "definitions needed to parse the elf program/segment headers"
---
# `elf_segment_type_E` - enum
- **Null** - Unused segment
- **Load** - Segment that should be included into mappings
- **Dynamic** - Segments of this type contain dynamic linking information
- **Interpreter** - This holds a path to an interpreter
- **Note** - These segments hold notes by the compiler / toolchain
- **Program Header Table** - This points to the table that is holding the segment headers
- **TLS** - This holds a Thread Local Storage template
# `elf_segment_T` - struct
| Name | Type | Description |
|------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------|
| type | uint32_t | The segments type -> [elf_segment_type_E](https://nerdcult.net/projects/noxos/docs/codebase/drivers/elf/segment.h/#elf_segment_type_e---enum) |
| flags | uint32_t | The segments flags (Read / Write / Execute) |
| offset | uint64_t | The segments position in the elf file |
| address_virtual | uint64_t | Where the segment should be mapped in the virtual address space |
| address_physical | uint64_t | Not used in the `System V` ABI |
| length_file | uint64_t | The segments size in the file |
| length_memory | uint64_t | The size of the area that should be mapped for the segment |
| align | uint64_t | The segments alignment (has to be a power of 2) |
# `g_elf_segment_type_strings` - global variable
An array of strings matching [elf_segment_type_E](https://nerdcult.net/projects/noxos/docs/codebase/drivers/elf/segment.h/#elf_segment_type_e---enum).