ddn.elf.symtab
ELF symbol table handling functionality.
This module provides utilities for reading, searching, and building ELF symbol tables. Symbol tables contain information about the symbols (functions, variables, etc.) defined in an ELF file.
Types 4
structElfSymbol
Represents a symbol in an ELF file.
This struct provides lazy access to symbol information from a symbol table.
Fields
const(ubyte)[] _datasize_t _indexElfStringTable _strtabtypes.ElfClass _classgelf.SymbolTableEntry _cachedEntrybool _entryCachedMethods
gelf.SymbolTableEntry getEntry()Get the symbol's raw GELF entry.string getName()Get the symbol's name from the associated string table.ulong getValue()Get the symbol's value (address or offset).ulong getSize()Get the symbol's size.types.SymbolBinding getBinding()Get the symbol's binding (local, global, or weak).types.SymbolType getType()Get the symbol's type (notype, object, function, etc.).types.SymbolVisibility getVisibility()Get the symbol's visibility (default, hidden, protected, or internal).ushort getSection()Get the section index this symbol is associated with.bool isUndefined()Check if this symbol is undefined (no associated section).bool isAbsolute()Check if this symbol is absolute (not associated with any section).bool isCommon()Check if this symbol is a common symbol.bool isFunction()Check if this symbol is a function.bool isObject()Check if this symbol is an object (variable, array, etc.).bool isLocal()Check if this symbol has local binding.bool isGlobal()Check if this symbol has global binding.bool isWeak()Check if this symbol has weak binding.bool isEmpty() constConstructors
this(const(ubyte)[] data, size_t index, ElfStringTable strtab,
types.ElfClass elfClass)Constructor from raw symbol table data.structSymbolRange
Range for iterating over symbols in a symbol table.
Implements the D InputRange interface.
Fields
const(ubyte)[] _datasize_t _currentIndexsize_t _totalSymbolsElfStringTable _strtabtypes.ElfClass _classMethods
void popFront()Advance to the next symbol.typeof(this) save()Save the current state of the range.Constructors
this()Constructor for creating an empty range.this(const(ubyte)[] data, size_t totalSymbols, ElfStringTable strtab,
types.ElfClass elfClass)Constructor from symbol table data.this(const(ubyte)[] data, size_t currentIndex, size_t totalSymbols,
ElfStringTable strtab, types.ElfClass elfClass)Private constructor for creating saved copies.structElfSymbolTable
Represents an ELF symbol table.
This struct provides access to symbols in either the .symtab (static) or .dynsym (dynamic) sections of an ELF file.
Methods
ElfSymbol findSymbolByName(string name)Find a symbol by its name.ElfSymbol findSymbolByAddress(ulong addr)Find a symbol containing the given address.SymbolRange symbols()Iterate over all symbols.SymbolRange localSymbols()Iterate over local symbols.SymbolRange globalSymbols()Iterate over global and weak symbols.structSymbolTableBuilder
Builder for creating ELF symbol tables.
This struct allows incremental construction of a symbol table with automatic ordering (local symbols before global symbols).
Fields
gelf.SymbolTableEntry[] _symbolsMethods
size_t addSymbol(uint name, ulong value, ulong size,
types.SymbolBinding binding, types.SymbolType type,
ushort section, types.SymbolVisibility visibility = types.SymbolVisibility.DEFAULT)Add a symbol to the symbol table.ubyte[] build()Build the final symbol table byte array.void clear(gelf.SymbolTableEntry initialEntry)Clear all symbols from the builder.Constructors
this(gelf.SymbolTableEntry initialEntry)Default constructor - creates an empty builder with initial entry.Functions 2
fn
ElfSymbolTable getSymbolTable(ElfFile file)Get the static symbol table (.symtab) from an ELF file.fn
ElfSymbolTable getDynamicSymbolTable(ElfFile file)Get the dynamic symbol table (.dynsym) from an ELF file.