Enum mach_object::LoadCommand
[−]
[src]
pub enum LoadCommand { Segment { segname: String, vmaddr: usize, vmsize: usize, fileoff: usize, filesize: usize, maxprot: vm_prot_t, initprot: vm_prot_t, flags: SegmentFlags, sections: Vec<Rc<Section>>, }, Segment64 { segname: String, vmaddr: usize, vmsize: usize, fileoff: usize, filesize: usize, maxprot: vm_prot_t, initprot: vm_prot_t, flags: SegmentFlags, sections: Vec<Rc<Section>>, }, IdFvmLib(FvmLib), LoadFvmLib(FvmLib), IdDyLib(DyLib), LoadDyLib(DyLib), LoadWeakDyLib(DyLib), ReexportDyLib(DyLib), LoadUpwardDylib(DyLib), LazyLoadDylib(DyLib), IdDyLinker(LcString), LoadDyLinker(LcString), DyLdEnv(LcString), SymTab { symoff: u32, nsyms: u32, stroff: u32, strsize: u32, }, DySymTab { ilocalsym: u32, nlocalsym: u32, iextdefsym: u32, nextdefsym: u32, iundefsym: u32, nundefsym: u32, tocoff: u32, ntoc: u32, modtaboff: u32, nmodtab: u32, extrefsymoff: u32, nextrefsyms: u32, indirectsymoff: u32, nindirectsyms: u32, extreloff: u32, nextrel: u32, locreloff: u32, nlocrel: u32, }, Uuid(Uuid), CodeSignature(LinkEditData), SegmentSplitInfo(LinkEditData), FunctionStarts(LinkEditData), DataInCode(LinkEditData), DylibCodeSignDrs(LinkEditData), LinkerOptimizationHint(LinkEditData), VersionMin { target: BuildTarget, version: VersionTag, sdk: VersionTag, }, DyldInfo { rebase_off: u32, rebase_size: u32, bind_off: u32, bind_size: u32, weak_bind_off: u32, weak_bind_size: u32, lazy_bind_off: u32, lazy_bind_size: u32, export_off: u32, export_size: u32, }, EntryPoint { entryoff: u64, stacksize: u64, }, SourceVersion(SourceVersionTag), Command { cmd: u32, payload: Vec<u8>, }, }
The load commands directly follow the mach_header.
Variants
Segment
The segment load command indicates that a part of this file is to be mapped into the task's address space.
The size of this segment in memory, vmsize, maybe equal to or larger than the amount to map from this file, filesize. The file is mapped starting at fileoff to the beginning of the segment in memory, vmaddr. The rest of the memory of the segment, if any, is allocated zero fill on demand. The segment's maximum virtual memory protection and initial virtual memory protection are specified by the maxprot and initprot fields. If the segment has sections then the section structures directly follow the segment command and their size is reflected in cmdsize.
Fields of Segment
segname: String | segment name |
vmaddr: usize | memory address of this segment |
vmsize: usize | memory size of this segment |
fileoff: usize | file offset of this segment |
filesize: usize | amount to map from the file |
maxprot: vm_prot_t | maximum VM protection |
initprot: vm_prot_t | initial VM protection |
flags: SegmentFlags | flags |
sections: Vec<Rc<Section>> | sections |
Segment64
The 64-bit segment load command indicates that a part of this file is to be mapped into a 64-bit task's address space.
If the 64-bit segment has sections then section_64 structures directly follow the 64-bit segment command and their size is reflected in cmdsize.
Fields of Segment64
segname: String | segment name |
vmaddr: usize | memory address of this segment |
vmsize: usize | memory size of this segment |
fileoff: usize | file offset of this segment |
filesize: usize | amount to map from the file |
maxprot: vm_prot_t | maximum VM protection |
initprot: vm_prot_t | initial VM protection |
flags: SegmentFlags | flags |
sections: Vec<Rc<Section>> | sections |
IdFvmLib(FvmLib)
fixed VM shared library identification
LoadFvmLib(FvmLib)
load a specified fixed VM shared library
IdDyLib(DyLib)
dynamically linked shared lib ident
LoadDyLib(DyLib)
load a dynamically linked shared library
LoadWeakDyLib(DyLib)
load a dynamically linked shared library that is allowed to be missing (all symbols are weak imported).
ReexportDyLib(DyLib)
load and re-export dylib
LoadUpwardDylib(DyLib)
load upward dylib
LazyLoadDylib(DyLib)
delay load of dylib until first use
IdDyLinker(LcString)
dynamic linker identification
LoadDyLinker(LcString)
load a dynamic linker
DyLdEnv(LcString)
string for dyld to treat like environment variable
SymTab
The symtab_command contains the offsets and sizes of the link-edit 4.3BSD
"stab" style symbol table information as described in the header files
Fields of SymTab
symoff: u32 | symbol table offset |
nsyms: u32 | number of symbol table entries |
stroff: u32 | string table offset |
strsize: u32 | string table size in bytes |
DySymTab
This is the second set of the symbolic information which is used to support the data structures for the dynamically link editor.
The original set of symbolic information in the symtab_command which contains the symbol and string tables must also be present when this load command is present. When this load command is present the symbol table is organized into three groups of symbols: local symbols (static and debugging symbols) - grouped by module defined external symbols - grouped by module (sorted by name if not lib) undefined external symbols (sorted by name if MH_BINDATLOAD is not set, and in order the were seen by the static linker if MH_BINDATLOAD is set) In this load command there are offsets and counts to each of the three groups of symbols.
This load command contains a the offsets and sizes of the following new symbolic information tables: table of contents module table reference symbol table indirect symbol table The first three tables above (the table of contents, module table and reference symbol table) are only present if the file is a dynamically linked shared library. For executable and object modules, which are files containing only one module, the information that would be in these three tables is determined as follows: table of contents - the defined external symbols are sorted by name module table - the file contains only one module so everything in the file is part of the module. reference symbol table - is the defined and undefined external symbols
For dynamically linked shared library files this load command also contains offsets and sizes to the pool of relocation entries for all sections separated into two groups: external relocation entries local relocation entries For executable and object modules the relocation entries continue to hang off the section structures.
Fields of DySymTab
ilocalsym: u32 | index to local symbols |
nlocalsym: u32 | number of local symbols |
iextdefsym: u32 | index to externally defined symbols |
nextdefsym: u32 | number of externally defined symbols |
iundefsym: u32 | index to undefined symbols |
nundefsym: u32 | number of undefined symbols |
tocoff: u32 | file offset to table of contents |
ntoc: u32 | number of entries in table of contents |
modtaboff: u32 | file offset to module table |
nmodtab: u32 | number of module table entries |
extrefsymoff: u32 | offset to referenced symbol table |
nextrefsyms: u32 | number of referenced symbol table entries |
indirectsymoff: u32 | file offset to the indirect symbol table |
nindirectsyms: u32 | number of indirect symbol table entries |
extreloff: u32 | offset to external relocation entries |
nextrel: u32 | number of external relocation entries |
locreloff: u32 | offset to local relocation entries |
nlocrel: u32 | number of local relocation entries |
Uuid(Uuid)
The uuid load command contains a single 128-bit unique random number that identifies an object produced by the static link editor.
CodeSignature(LinkEditData)
local of code signature
SegmentSplitInfo(LinkEditData)
local of info to split segments
FunctionStarts(LinkEditData)
compressed table of function start addresses
DataInCode(LinkEditData)
table of non-instructions in __text
DylibCodeSignDrs(LinkEditData)
Code signing DRs copied from linked dylibs
LinkerOptimizationHint(LinkEditData)
optimization hints in MH_OBJECT files
VersionMin
The version_min_command contains the min OS version on which this binary was built to run.
Fields of VersionMin
target: BuildTarget | |
version: VersionTag | |
sdk: VersionTag |
DyldInfo
The dyld_info_command contains the file offsets and sizes of the new compressed form of the information dyld needs to load the image. This information is used by dyld on Mac OS X 10.6 and later. All information pointed to by this command is encoded using byte streams, so no endian swapping is needed to interpret it.
Fields of DyldInfo
rebase_off: u32 | file offset to rebase info |
rebase_size: u32 | size of rebase info |
bind_off: u32 | file offset to binding info |
bind_size: u32 | size of binding info |
weak_bind_off: u32 | file offset to weak binding info |
weak_bind_size: u32 | size of weak binding info |
lazy_bind_off: u32 | file offset to lazy binding info |
lazy_bind_size: u32 | size of lazy binding infs |
export_off: u32 | file offset to lazy binding info |
export_size: u32 | size of lazy binding infs |
EntryPoint
The entry_point_command is a replacement for thread_command. It is used for main executables to specify the location (file offset) of main(). If -stack_size was used at link time, the stacksize field will contain the stack size need for the main thread.
Fields of EntryPoint
entryoff: u64 | file (__TEXT) offset of main() |
stacksize: u64 | if not zero, initial stack size |
SourceVersion(SourceVersionTag)
The source_version_command is an optional load command containing the version of the sources used to build the binary.
Command
Fields of Command
cmd: u32 | type of load command |
payload: Vec<u8> | command in bytes |
Methods
impl LoadCommand
[src]
fn parse<O: ByteOrder, T: AsRef<[u8]>>(
buf: &mut Cursor<T>
) -> Result<(LoadCommand, usize), Error>
[src]
buf: &mut Cursor<T>
) -> Result<(LoadCommand, usize), Error>
fn cmd(&self) -> u32
[src]
fn name(&self) -> &'static str
[src]
Trait Implementations
impl Debug for LoadCommand
[src]
impl Clone for LoadCommand
[src]
fn clone(&self) -> LoadCommand
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more