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
Structs
- This is the main interface to read and write Mach-O binary attributes.
- This structure represents an export (info) in a Mach-O binary
- This structure represents a FAT Mach-O
- Structure that represents the main Mach-O header (at the beginning of the file)
- This structure is used to tweak the MachO parser:
crate::macho::FatBinary::parse_with_config - This class represents a stub entry in sections like
__stubs,__auth_stubs. - Structure that represents a Symbol in a Mach-O file.
- This class represents a MachO section whose type is
crate::macho::section::Type::THREAD_LOCAL_VARIABLES.
Enums
- This enum exposes all the different types of binding operations that we can find in a Mach-O binary.
BindingInfo::Dyldexposes the bindings info wrapped in theLC_DYLD_INFOcommand whileBindingInfo::Chainedexposes the new chained bindings implemented in theDYLD_CHAINED_FIXUPScommand. - Enum that wraps all the different Mach-O load commands (
LC_xxx). Note that all these commands implements the trait:Command - Mach-O magic values
- Enum that represents the different to encode/represent a relocation in a Mach-O file
- Enum that wraps all the Mach-O section types, dispatching to the appropriate concrete type when extra semantics are available.
Traits
- Trait shared by all Mach-O section types in the
Sectionenum.
Functions
- Check that the layout of the given FAT binary is correct from the loader perspective
- Check that the layout of the given binary is correct from the loader perspective
- Check if the given file is a 64-bit Mach-O
- Check if the given file is a FAT Mach-O
- Parse a Mach-O file from the given file path
- Parse a Mach-O file from the given file path with the provided parser configuration