extern structstd.macho.segment_command[src]

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

cmd: LC = .SEGMENT

LC_SEGMENT

cmdsize: u32

includes sizeof section structs

segname: [16]u8

segment name

vmaddr: u32

memory address of this segment

vmsize: u32

memory size of this segment

fileoff: u32

file offset of this segment

filesize: u32

amount to map from the file

maxprot: vm_prot_t

maximum VM protection

initprot: vm_prot_t

initial VM protection

nsects: u32

number of sections in segment

flags: u32

Source Code

Source code
pub const segment_command = extern struct {
    /// LC_SEGMENT
    cmd: LC = .SEGMENT,

    /// includes sizeof section structs
    cmdsize: u32,

    /// segment name
    segname: [16]u8,

    /// memory address of this segment
    vmaddr: u32,

    /// memory size of this segment
    vmsize: u32,

    /// file offset of this segment
    fileoff: u32,

    /// amount to map from the file
    filesize: u32,

    /// maximum VM protection
    maxprot: vm_prot_t,

    /// initial VM protection
    initprot: vm_prot_t,

    /// number of sections in segment
    nsects: u32,
    flags: u32,
}