pub const segment_command_64 = extern struct cmd: LC = .SEGMENT_64LC_SEGMENT_64
cmdsize: u32includes sizeof section_64 structs
segname: [16]u8segment name
vmaddr: u64 = 0memory address of this segment
vmsize: u64 = 0memory size of this segment
fileoff: u64 = 0file offset of this segment
filesize: u64 = 0amount to map from the file
maxprot: vm_prot_t = .{}maximum VM protection
initprot: vm_prot_t = .{}initial VM protection
nsects: u32 = 0number of sections in segment
flags: u32 = 0pub fn segName(seg: *const segment_command_64) []const u8pub fn isWriteable(seg: segment_command_64) bool657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698pub const segment_command_64 = extern struct {
/// LC_SEGMENT_64
cmd: LC = .SEGMENT_64,
/// includes sizeof section_64 structs
cmdsize: u32,
// TODO lazy values in stage2
// cmdsize: u32 = @sizeOf(segment_command_64),
/// segment name
segname: [16]u8,
/// memory address of this segment
vmaddr: u64 = 0,
/// memory size of this segment
vmsize: u64 = 0,
/// file offset of this segment
fileoff: u64 = 0,
/// amount to map from the file
filesize: u64 = 0,
/// maximum VM protection
maxprot: vm_prot_t = .{},
/// initial VM protection
initprot: vm_prot_t = .{},
/// number of sections in segment
nsects: u32 = 0,
flags: u32 = 0,
pub fn segName(seg: *const segment_command_64) []const u8 {
return parseName(&seg.segname);
}
pub fn isWriteable(seg: segment_command_64) bool {
return seg.initprot.write;
}
}
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.