Crate elfbin

source ·
Expand description

A small library for creating ELF object files that contain symbols which refer to arbitrary data.

This is a specialized utility library focused only on that singular task. It isn’t a generic library for generating ELF files of all sorts, nor does it support any other object file formats.

// Create a new builder, establishing the ELF header values
let mut builder = elfbin::Builder::new(
    elfbin::Header {
        class: elfbin::Class::ELF64,
        encoding: elfbin::Encoding::LSB,
        machine: 64, // x86_64
        flags: 0,
    &mut output_file,

// Defile a symbol from any std::io::Read implementation.
builder.add_symbol("example", &b"hello!"[..])?;

// Close the builder to finalize the ELF metadata.


Represents an ELF file under construction.
Represents the main ELF header.
Represents one symbol that’s been written already to a Builder.


ELF file class (32-bit or 64-bit).
ELF encoding format (little endian or big endian).