[][src]Struct metagoblin::mach::MachO

pub struct MachO<'a> {
    pub header: Header,
    pub load_commands: Vec<LoadCommand, Global>,
    pub segments: Segments<'a>,
    pub symbols: Option<Symbols<'a>>,
    pub libs: Vec<&'a str, Global>,
    pub entry: u64,
    pub old_style_entry: bool,
    pub name: Option<&'a str>,
    pub little_endian: bool,
    pub is_64: bool,
    // some fields omitted
}

A cross-platform, zero-copy, endian-aware, 32/64 bit Mach-o binary parser

Fields

header: Header

The mach-o header

load_commands: Vec<LoadCommand, Global>

The load commands tell the kernel and dynamic linker how to use/interpret this binary

segments: Segments<'a>

The load command "segments" - typically the pieces of the binary that are loaded into memory

symbols: Option<Symbols<'a>>

The "Nlist" style symbols in this binary - strippable

libs: Vec<&'a str, Global>

The dylibs this library depends on

entry: u64

The entry point (as a virtual memory address), 0 if none

old_style_entry: bool

Whether entry refers to an older LC_UNIXTHREAD instead of the newer LC_MAIN entrypoint

name: Option<&'a str>

The name of the dylib, if any

little_endian: bool

Are we a little-endian binary?

is_64: bool

Are we a 64-bit binary

Implementations

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

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

Is this a relocatable object file?

pub fn symbols(&self) -> SymbolIterator<'a>

Notable traits for SymbolIterator<'a>

impl<'a> Iterator for SymbolIterator<'a> type Item = Result<(&'a str, Nlist), Error>;
[src]

Return an iterator over all the symbols in this binary

pub fn relocations(
    &self
) -> Result<Vec<(usize, RelocationIterator<'_>, Section), Global>, Error>
[src]

Return a vector of the relocations in this binary

pub fn exports(&self) -> Result<Vec<Export<'_>, Global>, Error>[src]

Return the exported symbols in this binary (if any)

pub fn imports(&self) -> Result<Vec<Import<'_>, Global>, Error>[src]

Return the imported symbols in this binary that dyld knows about (if any)

pub fn parse(bytes: &'a [u8], offset: usize) -> Result<MachO<'a>, Error>[src]

Parses the Mach-o binary from bytes at offset

Trait Implementations

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

Auto Trait Implementations

impl<'a> RefUnwindSafe for MachO<'a>

impl<'a> Send for MachO<'a>

impl<'a> Sync for MachO<'a>

impl<'a> Unpin for MachO<'a>

impl<'a> UnwindSafe for MachO<'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.