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

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

segment name

memory address of this segment

memory size of this segment

file offset of this segment

amount to map from the file

maximum VM protection

initial VM protection

flags

sections

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

segment name

memory address of this segment

memory size of this segment

file offset of this segment

amount to map from the file

maximum VM protection

initial VM protection

flags

sections

fixed VM shared library identification

load a specified fixed VM shared library

dynamically linked shared lib ident

load a dynamically linked shared library

load a dynamically linked shared library that is allowed to be missing (all symbols are weak imported).

load and re-export dylib

load upward dylib

delay load of dylib until first use

dynamic linker identification

load a dynamic linker

string for dyld to treat like environment variable

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 and .

Fields of SymTab

symbol table offset

number of symbol table entries

string table offset

string table size in bytes

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

index to local symbols

number of local symbols

index to externally defined symbols

number of externally defined symbols

index to undefined symbols

number of undefined symbols

file offset to table of contents

number of entries in table of contents

file offset to module table

number of module table entries

offset to referenced symbol table

number of referenced symbol table entries

file offset to the indirect symbol table

number of indirect symbol table entries

offset to external relocation entries

number of external relocation entries

offset to local relocation entries

number of local relocation entries

The uuid load command contains a single 128-bit unique random number that identifies an object produced by the static link editor.

local of code signature

local of info to split segments

compressed table of function start addresses

table of non-instructions in __text

Code signing DRs copied from linked dylibs

optimization hints in MH_OBJECT files

The version_min_command contains the min OS version on which this binary was built to run.

Fields of VersionMin

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

file offset to rebase info

size of rebase info

file offset to binding info

size of binding info

file offset to weak binding info

size of weak binding info

file offset to lazy binding info

size of lazy binding infs

file offset to lazy binding info

size of lazy binding infs

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

file (__TEXT) offset of main()

if not zero, initial stack size

The source_version_command is an optional load command containing the version of the sources used to build the binary.

Fields of Command

type of load command

command in bytes

Methods

impl LoadCommand
[src]

[src]

[src]

[src]

Trait Implementations

impl Debug for LoadCommand
[src]

[src]

Formats the value using the given formatter.

impl Clone for LoadCommand
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more