Module macho

Module macho 

Expand description

Module for the Mach-O file format support in LIEF.

To get started, one can use crate::macho::parse, crate::macho::FatBinary::parse or crate::Binary::parse to instantiate a crate::macho::FatBinary.

Even though the targeted Mach-O binary is not FAT, LIEF always return a crate::macho::FatBinary which can wrap a single Binary.

let fat = lief::macho::parse("non-fat.macho").unwrap();
assert!(fat.iter().len() == 1);

let fat = lief::macho::parse("real-fat.macho").unwrap();
assert!(fat.iter().len() > 1);

The Binary structure exposes the main interface to inspect or modify Mach-O binaries:

fn inspect_macho(macho: &lief::macho::Binary) {
    for cmd in macho.commands() {
        println!("{:?}", cmd);
    }
}

Modules§

binary
binding_info
builder
commands
export_info
fat_binary
header
relocation
section
stub
symbol

Structs§

Binary
This is the main interface to read and write Mach-O binary attributes.
ExportInfo
This structure represents an export (info) in a Mach-O binary
FatBinary
This structure represents a FAT Mach-O
Header
Structure that represents the main Mach-O header (at the beginning of the file)
Section
Stub
This class represents a stub entry in sections like __stubs,__auth_stubs.
Symbol
Structure that represents a Symbol in a Mach-O file.

Enums§

BindingInfo
This enum exposes all the different types of binding operations that we can find in a Mach-O binary. BindingInfo::Dyld exposes the bindings info wrapped in the LC_DYLD_INFO command while BindingInfo::Chained exposes the new chained bindings implemented in the DYLD_CHAINED_FIXUPS command.
Commands
Enum that wraps all the different Mach-O load commands (LC_xxx). Note that all these commands implements the trait: Command
Relocation
Enum that represents the different to encode/represent a relocation in a Mach-O file

Functions§

parse
Parse a Mach-O file from the given file path