Skip to content
ElfFileFindSection

ElfFileFindSection

Description

Find a section by name (first match). Returns NULL if absent.

Usage example (Cross-references)

Usage examples (Cross-references)
        }
    
        const ElfSection *text = ElfFileFindSection(&elf, ".text");
        bool              ok   = text != NULL && text->size > 0 && (text->flags & 0x4); // SHF_EXECINSTR = 0x4
        out->string_pool = StrInit(alloc);
    
        const ElfSection *line_section = ElfFileFindSection(elf, ".debug_line");
        if (!line_section || line_section->size == 0) {
            // No debug info — empty result is still success.
    }
    
    const ElfSection *ElfFileFindSection(const ElfFile *self, const char *name) {
        if (!self || !name)
            return NULL;
Last updated on