Crate elf_rs

Source
Expand description

A simple no_std ELF file reader for ELF32 and ELF64.

§Minimal Example

use elf_rs::Elf;

/// Minimal example. Works in `no_std`-contexts and the parsing
/// itself needs zero allocations.
fn main() {
    let elf_bytes = include_bytes!("path/to/file.elf");
    let elf = elf_rs::Elf::from_bytes(elf_bytes).unwrap();
    let elf64 = match elf {
        Elf::Elf64(elf) => elf,
        _ => panic!("got Elf32, expected Elf64"),
    };
    let pr_hdrs = elf64.program_header_iter().collect::<Vec<_>>();
    dbg!(pr_hdrs);
}

Structs§

ElfHeader
ProgramHeader32
ProgramHeader64
ProgramHeaderEntry
ProgramHeaderFlags
The flags of an ELF program header. Always 32 bit long, also for 64-bit ELFs.
ProgramHeaderIter
SectionHeaderEntry
SectionHeaderFlags
SectionHeaderIter

Enums§

Elf
ElfAbi
ElfClass
ElfEndian
ElfMachine
ElfType
Error
ProgramType
SectionType

Traits§

ElfFile
ElfHeaderRaw
ProgramHeaderRaw
SectionHeaderRaw

Type Aliases§

Elf32
Elf64
ElfHeader32
ElfHeader64
SectionHeader32
SectionHeader64