ElfSymbol
Description
Decoded symbol-table entry. name is borrowed from the file’s .strtab (for symbols) or .dynstr (for dynamic_symbols).
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Elf.c:64:
bool ok = false;
for (u64 i = 0; i < elf.symbols.length; ++i) {
const ElfSymbol *s = &elf.symbols.data[i];
if (s->type == ELF_SYMBOL_TYPE_FUNC && s->size > 0 && s->name && s->name[0] != '\0') {
ok = true;
u64 file_relative = addr - load_base;
const ElfSymbol *sym = ElfFileResolveAddress(&cache_entry->elf, file_relative);
if (sym && sym->name && sym->name[0]) {
out->symbol_name = sym->name;- In
Elf.c:273:
StrReadFmt(cursor, FMT_SYM64_LE, name, info, other, shndx, value, size_);
ElfSymbol s;
s.name = elf_str_at(self, strtab->offset, strtab->size, name);
s.bind = (ElfSymbolBind)(info >> 4);- In
Elf.c:381:
// ---------------------------------------------------------------------------
static const ElfSymbol *elf_search_symbols(const ElfSymbols *syms, u64 vaddr) {
const ElfSymbol *best = NULL;
for (u64 i = 0; i < syms->length; ++i) {- In
Elf.c:382:
static const ElfSymbol *elf_search_symbols(const ElfSymbols *syms, u64 vaddr) {
const ElfSymbol *best = NULL;
for (u64 i = 0; i < syms->length; ++i) {
const ElfSymbol *s = &syms->data[i];- In
Elf.c:384:
const ElfSymbol *best = NULL;
for (u64 i = 0; i < syms->length; ++i) {
const ElfSymbol *s = &syms->data[i];
if (s->size == 0) {
// Some symbols (e.g. labels) have zero size — only match
- In
Elf.c:404:
}
const ElfSymbol *ElfFileResolveAddress(const ElfFile *self, u64 vaddr) {
if (!self)
return NULL;- In
Elf.c:407:
if (!self)
return NULL;
const ElfSymbol *hit = elf_search_symbols(&self->symbols, vaddr);
if (hit)
return hit;- In
Elf.h:129:
u64 value; // virtual address for ET_EXEC / ET_DYN
u64 size;
} ElfSymbol;
typedef Vec(ElfSection) ElfSections;- In
Elf.h:132:
typedef Vec(ElfSection) ElfSections;
typedef Vec(ElfSymbol) ElfSymbols;
///
- In
Elf.h:226:
/// TAGS: Parser, ELF, Symbol
///
const ElfSymbol *ElfFileResolveAddress(const ElfFile *self, u64 vaddr);
///
Last updated on