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

27 lines
1.3 KiB
Markdown
Raw Normal View History

2023-05-28 17:16:43 +00:00
# symbol.h
Stuff needed to extract symbols from an ELFs `.symtab` section.
# `ELF_SYMBOL_TYPE(info)` - macro
Extracts the elf_symbol_type_E from the symbols info value.
# `elf_symbol_type_E` - enum
- **None** - Unspecified type
- **Object** - Data objects like variables, arrays, etc.
- **Func** - Function
- **Section** - Associated section
- **File** - The path to the source file associated with the object
- **Common** - Uninitialized common blocks
- **TLS** - Thread Local Storage
# `elf_symbol_T` - struct
| Name | Type | Description |
|-----------------------|-------------------------------------------------------------------|-------------|
| name_offset | The offset of the symbols name in `.strtab` | |
| info | Information about the symbol (type, bind) | |
| other | Information about the symbol (visibility) | |
| related_section_index | The index of the symbols related section | |
| value | Value, in most cases this is an address | |
| length | The size of the symbol (e.g. num bytes if the symbol is an array) | |