ddn.elf.dynamic

ELF dynamic section handling functionality.

This module provides utilities for reading and manipulating ELF dynamic sections, which contain information needed for dynamic linking and loading.

NOTE: Implementation is minimal to ensure GDC compatibility. Some advanced features may be limited.

Types 3

Represents a single entry in an ELF dynamic section.

Dynamic entries contain tags and values that describe how to program should be dynamically linked.

Fields
private gelf.DynamicEntry _entry
private ElfStringTable _strtab
Methods
types.DynamicTag getTag() pure nothrow @nogc @safe constGet the tag identifying the entry type.
ulong getValue() pure nothrow @nogc @safe constGet the integer value of this entry.
ulong getPointer() pure nothrow @nogc @safe constGet the pointer or address value of this entry.
string getString()Resolve this entry's integer value as a string from the string table.
Constructors
this(gelf.DynamicEntry entry, ElfStringTable strtab)Construct a dynamic entry.

Range for iterating over dynamic entries.

Fields
private const(ubyte)[] _data
private size_t _currentIndex
private size_t _totalEntries
private types.ElfClass _class
private ElfEndian _endian
private ElfStringTable _strtab
Methods
bool empty() constCheck if the range has been exhausted.
ElfDynamicEntry front()Get the current dynamic entry.
void popFront()Advance to the next dynamic entry.
typeof(this) save()Save the current state of the range.
private gelf.DynamicEntry readGelfEntry(size_t idx)
Constructors
this(const(ubyte)[] data, size_t totalEntries, types.ElfClass elfClass, ElfEndian endianness, ElfStringTable strtab)Construct a range over dynamic section entries.
this(const(ubyte)[] data, size_t currentIndex, size_t totalEntries, types.ElfClass elfClass, ElfEndian endianness, ElfStringTable strtab)Private constructor for creating saved copies of the range.

Represents an ELF dynamic section.

This struct provides access to dynamic linking information needed to load shared libraries and resolve symbols.

Fields
private const(ubyte)[] _data
private size_t _numEntries
private ElfStringTable _strtab
private types.ElfClass _class
private ElfEndian _endian
Methods
size_t numEntries() pure nothrow @nogc @safe constGet the number of active entries in the dynamic section.
ElfDynamicEntry getEntry(size_t index)Get the dynamic entry at the given 0-based index.
DynamicEntryRange entries()Get a range for iterating over all active dynamic entries.
string getSoname()Get the shared library name (DT_SONAME) if present.
string[] getNeededLibraries()Get the list of shared libraries this object depends on (DT_NEEDED).
string getRpath()Get the deprecated library search path (DT_RPATH) if present.
string getRunpath()Get the runtime library search path (DT_RUNPATH) if present.
bool hasTextRelocations()Check whether text relocations are present.
const(ElfStringTable) getStringTable() pure nothrow @nogc @safe ref return constGet the associated string table.
private gelf.DynamicEntry readGelfEntry(size_t idx)
Constructors
this(ElfFile file, size_t sectionIndex)Construct an ElfDynamic view over an ELF file's dynamic section.

Functions 2

fnElfDynamic getDynamic(ElfFile file)Get the dynamic section of an ELF file.
private fnElfDynamic buildDynamic(gelf.DynamicEntry[] entries)Build an ELF64 little-endian file with a .dynstr and a .dynamic section holding the given entries, and return the ElfDynamic for it.