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

Enums

Traits

Type Aliases