ddn.elf.sections

ELF section access and manipulation functionality.

This module provides comprehensive access to ELF file sections, including section enumeration, lookup by index or name, type filtering, and data access. All section access is lazy-loaded and cached for efficiency.

Types 3

Represents a single ELF section with lazy-loaded data.

This struct provides access to section header information, name, and data. All values are loaded lazily and cached for subsequent access.

Fields
ElfFile _file
size_t _index
string _name
const(ubyte)[] _data
bool _headerLoaded
bool _nameLoaded
bool _dataLoaded
Methods
void _loadHeader()Load the section header from the ELF file.
void _loadName()Load the section name from the section header string table.
size_t index() @property pure nothrow @nogc @safe constGet the section index.
gelf.SectionHeader getHeader()Get the section header.
string getName()Get the section name.
const(ubyte)[] getData()Get the section data.
bool isSymtab()Check if this is a symbol table section.
bool isStrtab()Check if this is a string table section.
bool isRela()Check if this is a RELA section (relocation with explicit addends).
bool isRel()Check if this is a REL section (relocation without addends).
bool isAllocatable()Check if this section is allocatable (occupies memory during execution).
bool isExecutable()Check if this section is executable.
bool isWritable()Check if this section is writable.
Constructors
this(ElfFile file, size_t index)Constructor.

Input range for iterating sections of a specific type.

This range filters sections by type and provides lazy-loaded ElfSection objects.

Fields
ElfFile _file
size_t _currentIndex
bool _initialized
Methods
void _initialize()Initialize and find the first matching section.
void _findNext()Find the next section matching the type.
bool empty() @propertyCheck if the range is empty.
ElfSection front() @propertyGet the current section.
void popFront()Advance to the next section.
typeof(this) save() @propertySave the current state of the range.
Constructors
this(ElfFile file, types.SectionType type)Constructor.
this(ElfFile file, types.SectionType type, gelf.SectionHeader[] headers, size_t currentIndex, bool initialized)Internal constructor for save().

Input range for iterating all sections in an ELF file.

This range provides lazy-loaded ElfSection objects for all sections.

Fields
ElfFile _file
size_t _currentIndex
size_t _totalSections
Methods
bool empty() @propertyCheck if the range is empty.
ElfSection front() @propertyGet the current section.
void popFront()Advance to the next section.
typeof(this) save() @propertySave the current state of the range.
Constructors
this(ElfFile file)Constructor.
this(ElfFile file, size_t currentIndex, size_t totalSections)Internal constructor for save().

Functions 4

fnSectionRange getSections(ElfFile file)Get a range for iterating all sections in an ELF file.
fnElfSection getSectionByIndex(ElfFile file, size_t index)Get a section by its index.
fnElfSection getSectionByName(ElfFile file, string name)Get a section by its name.
fnSectionTypeRange getSectionsByType(ElfFile file, types.SectionType type)Get a range for iterating sections of a specific type.