template <class ElfLayout, class AbiTraits = LocalAbiTraits>
class SymbolInfo
Defined at line 210 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
This represents all the dynamic symbol table information for one ELF file.
It's primarily used for hash table lookup via SymbolName::Lookup, but can
also be used to enumerate the symbol table or the hash tables. It holds
non-owning pointers into target data normally found in the RODATA segment.
Public Members
static const bool kLocal
Public Methods
void SymbolInfo<ElfLayout, AbiTraits> ()
Defined at line 228 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
void SymbolInfo<ElfLayout, AbiTraits> (LinkerZeroInitialized )
This constructor can be used to zero-initialize a SymbolInfo object.
This can be useful for performance reasons. Note, a SymbolInfo object in
this state must never be used until `InitLinkerZeroInitialized` has been
called.
Defined at line 234 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
void InitLinkerZeroInitialized ()
Defined at line 236 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
bool AnySymbol (const Sym & sym)
This is the degenerate (always true) filter predicate for Lookup.
Defined at line 239 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
bool DefinedSymbol (const Sym & sym)
This is the default filter predicate for Lookup to match defined symbols.
Defined at line 242 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
template <class HashTable, auto&& filter>
const Sym * Lookup (const HashTable & table, const SymbolName & name, uint32_t hash, SymbolFilterApi<Sym> auto && filter)
Look up a symbol in one of the hash tables. The filter is a predicate to
accept or reject symbols before name matching. This takes a SymbolName to
enforce the invariant that there are no embedded NUL characters. Its hash
fields are not used.
Defined at line 265 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
const Sym * LookupVaddr (size_type vaddr)
Find the "best" public symbol to describe the given address in the module.
Returns nullptr if no suitable symbol was found, or else a pointer into
symtab() to an element whose value..size range contains vaddr.
Defined at line 293 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
template <class HashTable>
auto HashedSymbols (const HashTable & table)
This returns a std::forward_range of const Sym
&
elements enumerating all
the symbols referenced by the hash table.
Defined at line 322 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
template <SymbolFilterApi<Sym> F>
bool OnSymbols (F && f)
This enumerates all the symbols referenced by the hash table (if present).
It returns false as soon as the callback returns false, otherwise true.
Defined at line 339 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
std::string_view strtab ()
Fetch the raw string table.
Defined at line 350 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
const char * string (size_t offset)
Fetch a NUL-terminated string from the string table by offset,
e.g. as stored in st_name or DT_SONAME.
Defined at line 354 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
const char * string (size_t offset)
Fetch a NUL-terminated string from the string table by offset,
e.g. as stored in st_name or DT_SONAME.
Defined at line 354 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
const char * string (size_t offset)
Fetch a NUL-terminated string from the string table by offset,
e.g. as stored in st_name or DT_SONAME.
Defined at line 354 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
std::span<const Sym> symtab ()
Fetch the raw symbol table. Note this size may be an upper bound. It's
all valid memory to read, but there might be garbage data past the last
actual valid symbol table index.
Defined at line 364 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
std::span<const Sym> safe_symtab ()
Fetch the symbol table and try to reduce its apparent size to its real
size or at least a better approximation. This provides no guarantee that
the size will be smaller than the raw symtab() size, but does a bit more
work to try to ensure it. If using only indices that are presumed to be
valid, such as those in relocation entries, just use symtab() instead.
This is better for blind enumeration.
Defined at line 372 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
std::optional<CompatHash> compat_hash ()
Return the CompatHash object (see compat-hash.h) if DT_HASH is valid.
Defined at line 375 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
std::optional<GnuHash> gnu_hash ()
Return the GnuHash object (see gnu-hash.h) if DT_GNU_HASH is valid.
Defined at line 385 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
std::string_view soname ()
Defined at line 394 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
size_type flags ()
Return the DT_FLAGS bits.
Defined at line 402 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
size_type flags1 ()
Return the DT_FLAGS_1 bits.
Defined at line 405 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
SymbolInfo<ElfLayout, AbiTraits> & set_strtab (std::string_view strtab)
Install data for the various tables. These return *this so they can be
called in fluent style, e.g. in a constexpr initializer.
Defined at line 410 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
SymbolInfo<ElfLayout, AbiTraits> & set_strtab (std::string_view strtab)
Install data for the various tables. These return *this so they can be
called in fluent style, e.g. in a constexpr initializer.
Defined at line 410 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
SymbolInfo<ElfLayout, AbiTraits> & set_strtab_as_span (std::span<const char> strtab)
Defined at line 419 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
SymbolInfo<ElfLayout, AbiTraits> & set_strtab_as_span (std::span<const char> strtab)
Defined at line 419 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
SymbolInfo<ElfLayout, AbiTraits> & set_strtab_as_span (std::span<const char> strtab)
Defined at line 419 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
SymbolInfo<ElfLayout, AbiTraits> & set_strtab_as_span (std::span<const char> strtab)
Defined at line 419 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
SymbolInfo<ElfLayout, AbiTraits> & set_strtab_as_span (std::span<const char> strtab)
Defined at line 419 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
SymbolInfo<ElfLayout, AbiTraits> & set_symtab (std::span<const Sym> symtab)
Defined at line 423 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
SymbolInfo<ElfLayout, AbiTraits> & set_symtab (std::span<const Sym> symtab)
Defined at line 423 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
SymbolInfo<ElfLayout, AbiTraits> & set_symtab (std::span<const Sym> symtab)
Defined at line 423 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
SymbolInfo<ElfLayout, AbiTraits> & set_symtab (std::span<const Sym> symtab)
Defined at line 423 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
SymbolInfo<ElfLayout, AbiTraits> & set_symtab (std::span<const Sym> symtab)
Defined at line 423 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
SymbolInfo<ElfLayout, AbiTraits> & set_compat_hash (std::span<const Word> table)
Defined at line 428 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
SymbolInfo<ElfLayout, AbiTraits> & set_compat_hash (std::span<const Word> table)
Defined at line 428 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
SymbolInfo<ElfLayout, AbiTraits> & set_compat_hash (std::span<const Word> table)
Defined at line 428 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
SymbolInfo<ElfLayout, AbiTraits> & set_compat_hash (std::span<const Word> table)
Defined at line 428 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
SymbolInfo<ElfLayout, AbiTraits> & set_compat_hash (std::span<const Word> table)
Defined at line 428 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
SymbolInfo<ElfLayout, AbiTraits> & set_gnu_hash (std::span<const Addr> table)
Defined at line 433 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
SymbolInfo<ElfLayout, AbiTraits> & set_gnu_hash (std::span<const Addr> table)
Defined at line 433 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
SymbolInfo<ElfLayout, AbiTraits> & set_gnu_hash (std::span<const Addr> table)
Defined at line 433 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
SymbolInfo<ElfLayout, AbiTraits> & set_gnu_hash (std::span<const Addr> table)
Defined at line 433 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
SymbolInfo<ElfLayout, AbiTraits> & set_gnu_hash (std::span<const Addr> table)
Defined at line 433 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
SymbolInfo<ElfLayout, AbiTraits> & set_soname (size_type soname)
Defined at line 438 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
SymbolInfo<ElfLayout, AbiTraits> & set_flags (size_type flags)
Defined at line 443 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h
SymbolInfo<ElfLayout, AbiTraits> & set_flags1 (size_type flags1)
Defined at line 448 of file ../../src/lib/elfldltl/include/lib/elfldltl/symbol.h