[][src]Struct goblin::elf::Elf

pub struct Elf<'a> {
    pub header: Header,
    pub program_headers: ProgramHeaders,
    pub section_headers: SectionHeaders,
    pub shdr_strtab: Strtab<'a>,
    pub dynstrtab: Strtab<'a>,
    pub dynsyms: Symtab<'a>,
    pub syms: Symtab<'a>,
    pub strtab: Strtab<'a>,
    pub dynamic: Option<Dynamic>,
    pub dynrelas: RelocSection<'a>,
    pub dynrels: RelocSection<'a>,
    pub pltrelocs: RelocSection<'a>,
    pub shdr_relocs: Vec<(ShdrIdx, RelocSection<'a>)>,
    pub soname: Option<&'a str>,
    pub interpreter: Option<&'a str>,
    pub libraries: Vec<&'a str>,
    pub is_64: bool,
    pub is_lib: bool,
    pub entry: u64,
    pub little_endian: bool,
    // some fields omitted
}

An ELF binary. The underlying data structures are read according to the headers byte order and container size (32 or 64).

Fields

header: Header

The ELF header, which provides a rudimentary index into the rest of the binary

program_headers: ProgramHeaders

The program headers; they primarily tell the kernel and the dynamic linker how to load this binary

section_headers: SectionHeaders

The sections headers. These are strippable, never count on them being here unless you're a static linker!

shdr_strtab: Strtab<'a>

The section header string table

dynstrtab: Strtab<'a>

The string table for the dynamically accessible symbols

dynsyms: Symtab<'a>

The dynamically accessible symbols, i.e., exports, imports. This is what the dynamic linker uses to dynamically load and link your binary, or find imported symbols for binaries which dynamically link against your library

syms: Symtab<'a>

The debugging symbol table

strtab: Strtab<'a>

The string table for the symbol table

dynamic: Option<Dynamic>

Contains dynamic linking information, with the _DYNAMIC array + a preprocessed DynamicInfo for that array

dynrelas: RelocSection<'a>

The dynamic relocation entries (strings, copy-data, etc.) with an addend

dynrels: RelocSection<'a>

The dynamic relocation entries without an addend

pltrelocs: RelocSection<'a>

The plt relocation entries (procedure linkage table). For 32-bit binaries these are usually Rel (no addend)

shdr_relocs: Vec<(ShdrIdx, RelocSection<'a>)>

Section relocations by section index (only present if this is a relocatable object file)

soname: Option<&'a str>

The binary's soname, if it has one

interpreter: Option<&'a str>

The binary's program interpreter (e.g., dynamic linker), if it has one

libraries: Vec<&'a str>

A list of this binary's dynamic libraries it uses, if there are any

is_64: bool

Whether this is a 64-bit elf or not

is_lib: bool

Whether this is a shared object or not

entry: u64

The binaries entry point address, if it has one

little_endian: bool

Whether the binary is little endian or not

Implementations

impl<'a> Elf<'a>[src]

pub fn iter_note_headers(&self, data: &'a [u8]) -> Option<NoteIterator<'a>>[src]

Try to iterate notes in PT_NOTE program headers; returns None if there aren't any note headers in this binary

pub fn iter_note_sections(
    &self,
    data: &'a [u8],
    section_name: Option<&str>
) -> Option<NoteIterator<'a>>
[src]

Try to iterate notes in SHT_NOTE sections; returns None if there aren't any note sections in this binary

If a section_name is given, only the section with the according name is iterated.

pub fn is_object_file(&self) -> bool[src]

pub fn parse(bytes: &'a [u8]) -> Result<Self>[src]

Parses the contents of the byte stream in bytes, and maybe returns a unified binary

Trait Implementations

impl<'a> Debug for Elf<'a>[src]

impl<'a> TryFromCtx<'a, (usize, Endian), [u8]> for Elf<'a>[src]

type Error = Error

Auto Trait Implementations

impl<'a> RefUnwindSafe for Elf<'a>

impl<'a> Send for Elf<'a>

impl<'a> Sync for Elf<'a>

impl<'a> Unpin for Elf<'a>

impl<'a> UnwindSafe for Elf<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.