ElfFindSection
Description
Find a section by name (first match). Returns NULL if absent.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Elf.c:42:
}
const ElfSection *text = ElfFindSection(&elf, ".text");
bool ok = text != NULL && text->size > 0 && (text->flags & 0x4); // SHF_EXECINSTR = 0x4
- In
Dwarf.c:541:
out->string_pool = StrInit(alloc);
const ElfSection *line_section = ElfFindSection(elf, ".debug_line");
if (!line_section || line_section->size == 0) {
// No debug info — empty result is still success.
- In
Elf.c:408:
static void elf_decode_debug_metadata(Elf *self) {
const ElfSection *note = ElfFindSection(self, ".note.gnu.build-id");
if (note) {
elf_decode_build_id(self, note);- In
Elf.c:412:
elf_decode_build_id(self, note);
}
const ElfSection *dl = ElfFindSection(self, ".gnu_debuglink");
if (dl) {
elf_decode_debug_link(self, dl);- In
Elf.c:530:
}
const ElfSection *ElfFindSection(const Elf *self, const char *name) {
if (!self || !name)
return NULL; out->fdes = VecInitT(out->fdes, alloc);
const ElfSection *eh = ElfFindSection(elf, ".eh_frame");
if (!eh || eh->size == 0) {
return true; // No CFI in this binary — still success, just empty.
- In
DwarfInfo.c:642:
LOG_FATAL("DwarfFunctionsBuildFromElf: NULL argument");
}
const ElfSection *info_sec = ElfFindSection(elf, ".debug_info");
const ElfSection *abbrev_sec = ElfFindSection(elf, ".debug_abbrev");
const ElfSection *str_sec = ElfFindSection(elf, ".debug_str");- In
DwarfInfo.c:643:
}
const ElfSection *info_sec = ElfFindSection(elf, ".debug_info");
const ElfSection *abbrev_sec = ElfFindSection(elf, ".debug_abbrev");
const ElfSection *str_sec = ElfFindSection(elf, ".debug_str");- In
DwarfInfo.c:644:
const ElfSection *info_sec = ElfFindSection(elf, ".debug_info");
const ElfSection *abbrev_sec = ElfFindSection(elf, ".debug_abbrev");
const ElfSection *str_sec = ElfFindSection(elf, ".debug_str");
const u8 *info_b = info_sec ? BufData(&elf->data) + info_sec->offset : NULL;
Last updated on