extern structstd.macho.section_64[src]

Fields

sectname: [16]u8

name of this section

segname: [16]u8

segment this section goes in

addr: u64 = 0

memory address of this section

size: u64 = 0

size in bytes of this section

offset: u32 = 0

file offset of this section

@"align": u32 = 0

section alignment (power of 2)

reloff: u32 = 0

file offset of relocation entries

nreloc: u32 = 0

number of relocation entries

flags: u32 = S_REGULAR

flags (section type and attributes

reserved1: u32 = 0

reserved (for offset or index)

reserved2: u32 = 0

reserved (for count or sizeof)

reserved3: u32 = 0

reserved

Functions

FunctionsectName[src]

pub fn sectName(sect: *const section_64) []const u8

Parameters

sect: *const section_64

Source Code

Source code
pub fn sectName(sect: *const section_64) []const u8 {
    return parseName(&sect.sectname);
}

FunctionsegName[src]

pub fn segName(sect: *const section_64) []const u8

Parameters

sect: *const section_64

Source Code

Source code
pub fn segName(sect: *const section_64) []const u8 {
    return parseName(&sect.segname);
}

Function@"type"[src]

pub fn @"type"(sect: section_64) u8

Parameters

Source Code

Source code
pub fn @"type"(sect: section_64) u8 {
    return @as(u8, @truncate(sect.flags & 0xff));
}

Functionattrs[src]

pub fn attrs(sect: section_64) u32

Parameters

Source Code

Source code
pub fn attrs(sect: section_64) u32 {
    return sect.flags & 0xffffff00;
}

FunctionisCode[src]

pub fn isCode(sect: section_64) bool

Parameters

Source Code

Source code
pub fn isCode(sect: section_64) bool {
    const attr = sect.attrs();
    return attr & S_ATTR_PURE_INSTRUCTIONS != 0 or attr & S_ATTR_SOME_INSTRUCTIONS != 0;
}

FunctionisZerofill[src]

pub fn isZerofill(sect: section_64) bool

Parameters

Source Code

Source code
pub fn isZerofill(sect: section_64) bool {
    const tt = sect.type();
    return tt == S_ZEROFILL or tt == S_GB_ZEROFILL or tt == S_THREAD_LOCAL_ZEROFILL;
}

FunctionisSymbolStubs[src]

pub fn isSymbolStubs(sect: section_64) bool

Parameters

Source Code

Source code
pub fn isSymbolStubs(sect: section_64) bool {
    const tt = sect.type();
    return tt == S_SYMBOL_STUBS;
}

FunctionisDebug[src]

pub fn isDebug(sect: section_64) bool

Parameters

Source Code

Source code
pub fn isDebug(sect: section_64) bool {
    return sect.attrs() & S_ATTR_DEBUG != 0;
}

FunctionisDontDeadStrip[src]

pub fn isDontDeadStrip(sect: section_64) bool

Parameters

Source Code

Source code
pub fn isDontDeadStrip(sect: section_64) bool {
    return sect.attrs() & S_ATTR_NO_DEAD_STRIP != 0;
}

FunctionisDontDeadStripIfReferencesLive[src]

pub fn isDontDeadStripIfReferencesLive(sect: section_64) bool

Parameters

Source Code

Source code
pub fn isDontDeadStripIfReferencesLive(sect: section_64) bool {
    return sect.attrs() & S_ATTR_LIVE_SUPPORT != 0;
}

Source Code

Source code
pub const section_64 = extern struct {
    /// name of this section
    sectname: [16]u8,

    /// segment this section goes in
    segname: [16]u8,

    /// memory address of this section
    addr: u64 = 0,

    /// size in bytes of this section
    size: u64 = 0,

    /// file offset of this section
    offset: u32 = 0,

    /// section alignment (power of 2)
    @"align": u32 = 0,

    /// file offset of relocation entries
    reloff: u32 = 0,

    /// number of relocation entries
    nreloc: u32 = 0,

    /// flags (section type and attributes
    flags: u32 = S_REGULAR,

    /// reserved (for offset or index)
    reserved1: u32 = 0,

    /// reserved (for count or sizeof)
    reserved2: u32 = 0,

    /// reserved
    reserved3: u32 = 0,

    pub fn sectName(sect: *const section_64) []const u8 {
        return parseName(&sect.sectname);
    }

    pub fn segName(sect: *const section_64) []const u8 {
        return parseName(&sect.segname);
    }

    pub fn @"type"(sect: section_64) u8 {
        return @as(u8, @truncate(sect.flags & 0xff));
    }

    pub fn attrs(sect: section_64) u32 {
        return sect.flags & 0xffffff00;
    }

    pub fn isCode(sect: section_64) bool {
        const attr = sect.attrs();
        return attr & S_ATTR_PURE_INSTRUCTIONS != 0 or attr & S_ATTR_SOME_INSTRUCTIONS != 0;
    }

    pub fn isZerofill(sect: section_64) bool {
        const tt = sect.type();
        return tt == S_ZEROFILL or tt == S_GB_ZEROFILL or tt == S_THREAD_LOCAL_ZEROFILL;
    }

    pub fn isSymbolStubs(sect: section_64) bool {
        const tt = sect.type();
        return tt == S_SYMBOL_STUBS;
    }

    pub fn isDebug(sect: section_64) bool {
        return sect.attrs() & S_ATTR_DEBUG != 0;
    }

    pub fn isDontDeadStrip(sect: section_64) bool {
        return sect.attrs() & S_ATTR_NO_DEAD_STRIP != 0;
    }

    pub fn isDontDeadStripIfReferencesLive(sect: section_64) bool {
        return sect.attrs() & S_ATTR_LIVE_SUPPORT != 0;
    }
}