#elf #parser #elf64 #32-64 #ehdr #phdr

no-std elf_parser

A minimal no_std ELF (32/64) parser

2 releases

0.1.1 Jan 29, 2022
0.1.0 Jan 29, 2022

#2556 in Parser implementations

MIT/Apache

36KB
1K SLoC

Contains (ELF exe/lib, 24KB) tests/data/elf64, (ELF exe/lib, 8KB) tests/data/elf32

elf_parser

A minimal no_std ELF (32/64) parser.

Example Usage

use elf_parser::Elf64;
 
fn main() {
    let bytes = include_bytes!("path/to/elf_file");
    let elf64 = Elf64::from_bytes(bytes).unwrap();
    let ehdr = elf64.ehdr();
    dbg!(ehdr);
     
    let phdr_iter = elf64.phdr_iter();
    for phdr_res in phdr_iter {
        let phdr = phdr_res.unwrap();        
        dbg!(phdr);
    }
}

lib.rs:

A minimal no_std ELF (32/64) parser.

Example Usage

use elf_parser::Elf64;

fn main() {
    let bytes = include_bytes!("path/to/elf_file");
    let elf64 = Elf64::from_bytes(bytes).unwrap();
    let ehdr = elf64.ehdr();
    dbg!(ehdr);
    
    let phdr_iter = elf64.phdr_iter();
    for phdr in phdr_iter {     
        dbg!(phdr);
    }
}

No runtime deps