types

package
v1.0.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2020 License: MIT Imports: 4 Imported by: 40

Documentation

Index

Constants

View Source
const (
	CpuSubtypeFeatureMask      CPUSubtype = 0xff000000                         /* mask for feature flags */
	CpuSubtypeMask                        = CPUSubtype(^CpuSubtypeFeatureMask) /* mask for cpu subtype */
	CpuSubtypeLib64                       = 0x80000000                         /* 64 bit libraries */
	CpuSubtypePtrauthAbi                  = 0x80000000                         /* pointer authentication with versioned ABI */
	CpuSubtypePtrauthAbiUser              = 0x40000000                         /* pointer authentication with userspace versioned ABI */
	CpuSubtypeArm64PtrAuthMask            = 0x0f000000
	/*
	 *      When selecting a slice, ANY will pick the slice with the best
	 *      grading for the selected cpu_type_t, unlike the "ALL" subtypes,
	 *      which are the slices that can run on any hardware for that cpu type.
	 */
	CpuSubtypeAny = -1
)

Capability bits used in the definition of cpu_subtype.

View Source
const (
	FileHeaderSize32 = 7 * 4
	FileHeaderSize64 = 8 * 4
)
View Source
const (
	/* types of references */
	REFERENCE_FLAG_UNDEFINED_NON_LAZY         nListDesc = 0
	REFERENCE_FLAG_UNDEFINED_LAZY             nListDesc = 1
	REFERENCE_FLAG_DEFINED                    nListDesc = 2
	REFERENCE_FLAG_PRIVATE_DEFINED            nListDesc = 3
	REFERENCE_FLAG_PRIVATE_UNDEFINED_NON_LAZY nListDesc = 4
	REFERENCE_FLAG_PRIVATE_UNDEFINED_LAZY     nListDesc = 5
)
View Source
const (
	SELF_LIBRARY_ORDINAL   nListDesc = 0x0
	MAX_LIBRARY_ORDINAL    nListDesc = 0xfd
	DYNAMIC_LOOKUP_ORDINAL nListDesc = 0xfe
	EXECUTABLE_ORDINAL     nListDesc = 0xff
)
View Source
const (
	/*
	 * The N_NO_DEAD_STRIP bit of the n_desc field only ever appears in a
	 * relocatable .o file (MH_OBJECT filetype). And is used to indicate to the
	 * static link editor it is never to dead strip the symbol.
	 */
	NO_DEAD_STRIP nListDesc = 0x0020 /* symbol is not to be dead stripped */

	/*
	 * The N_DESC_DISCARDED bit of the n_desc field never appears in linked image.
	 * But is used in very rare cases by the dynamic link editor to mark an in
	 * memory symbol as discared and longer used for linking.
	 */
	DESC_DISCARDED nListDesc = 0x0020 /* symbol is discarded */

	/*
	 * The N_WEAK_REF bit of the n_desc field indicates to the dynamic linker that
	 * the undefined symbol is allowed to be missing and is to have the address of
	 * zero when missing.
	 */
	WEAK_REF nListDesc = 0x0040 /* symbol is weak referenced */

	/*
	 * The N_WEAK_DEF bit of the n_desc field indicates to the static and dynamic
	 * linkers that the symbol definition is weak, allowing a non-weak symbol to
	 * also be used which causes the weak definition to be discared.  Currently this
	 * is only supported for symbols in coalesed sections.
	 */
	WEAK_DEF nListDesc = 0x0080 /* coalesed symbol is a weak definition */

	/*
	 * The N_REF_TO_WEAK bit of the n_desc field indicates to the dynamic linker
	 * that the undefined symbol should be resolved using flat namespace searching.
	 */
	REF_TO_WEAK nListDesc = 0x0080 /* reference to a weak symbol */

	/*
	 * The N_ARM_THUMB_DEF bit of the n_desc field indicates that the symbol is
	 * a defintion of a Thumb function.
	 */
	ARM_THUMB_DEF nListDesc = 0x0008 /* symbol is a Thumb function (ARM) */

	/*
	 * The N_SYMBOL_RESOLVER bit of the n_desc field indicates that the
	 * that the function is actually a resolver function and should
	 * be called to get the address of the real function to use.
	 * This bit is only available in .o files (MH_OBJECT filetype)
	 */
	SYMBOL_RESOLVER nListDesc = 0x0100

	/*
	 * The N_ALT_ENTRY bit of the n_desc field indicates that the
	 * symbol is pinned to the previous content.
	 */
	ALT_ENTRY nListDesc = 0x0200

	/*
	 * The N_COLD_FUNC bit of the n_desc field indicates that the symbol is used
	 * infrequently and the linker should order it towards the end of the section.
	 */
	N_COLD_FUNC nListDesc = 0x0400
)
View Source
const (
	N_GSYM  = 0x20 /* global symbol: name,,NO_SECT,type,0 */
	N_FNAME = 0x22 /* procedure name (f77 kludge): name,,NO_SECT,0,0 */
	N_FUN   = 0x24 /* procedure: name,,n_sect,linenumber,address */
	N_STSYM = 0x26 /* static symbol: name,,n_sect,type,address */
	N_LCSYM = 0x28 /* .lcomm symbol: name,,n_sect,type,address */
	N_BNSYM = 0x2e /* begin nsect sym: 0,,n_sect,0,address */
	N_AST   = 0x32 /* AST file path: name,,NO_SECT,0,0 */
	N_OPT   = 0x3c /* emitted with gcc2_compiled and in gcc source */
	N_RSYM  = 0x40 /* register sym: name,,NO_SECT,type,register */
	N_SLINE = 0x44 /* src line: 0,,n_sect,linenumber,address */
	N_ENSYM = 0x4e /* end nsect sym: 0,,n_sect,0,address */
	N_SSYM  = 0x60 /* structure elt: name,,NO_SECT,type,struct_offset */
	N_SO    = 0x64 /* source file name: name,,n_sect,0,address */
	N_OSO   = 0x66 /* object file name: name,,(see below),0,st_mtime */
	/*   historically N_OSO set n_sect to 0. The N_OSO
	 *   n_sect may instead hold the low byte of the
	 *   cpusubtype value from the Mach-O header. */
	N_LSYM    = 0x80 /* local sym: name,,NO_SECT,type,offset */
	N_BINCL   = 0x82 /* include file beginning: name,,NO_SECT,0,sum */
	N_SOL     = 0x84 /* #included file name: name,,n_sect,0,address */
	N_PARAMS  = 0x86 /* compiler parameters: name,,NO_SECT,0,0 */
	N_VERSION = 0x88 /* compiler version: name,,NO_SECT,0,0 */
	N_OLEVEL  = 0x8A /* compiler -O level: name,,NO_SECT,0,0 */
	N_PSYM    = 0xa0 /* parameter: name,,NO_SECT,type,offset */
	N_EINCL   = 0xa2 /* include file end: name,,NO_SECT,0,0 */
	N_ENTRY   = 0xa4 /* alternate entry: name,,n_sect,linenumber,address */
	N_LBRAC   = 0xc0 /* left bracket: 0,,NO_SECT,nesting level,address */
	N_EXCL    = 0xc2 /* deleted include file: name,,NO_SECT,0,sum */
	N_RBRAC   = 0xe0 /* right bracket: 0,,NO_SECT,nesting level,address */
	N_BCOMM   = 0xe2 /* begin common: name,,NO_SECT,0,0 */
	N_ECOMM   = 0xe4 /* end common: name,,n_sect,0,0 */
	N_ECOML   = 0xe8 /* end common (local name): 0,,n_sect,0,address */
	N_LENG    = 0xfe /* second stab entry with length information */
	/*
	 * for the berkeley pascal compiler, pc(1):
	 */
	N_PC = 0x30 /* global pascal symbol: name,,NO_SECT,subtype,line */
)

* Symbolic debugger symbols.

View Source
const (
	C_ID       = '@'
	C_CLASS    = '#'
	C_SEL      = ':'
	C_CHR      = 'c'
	C_UCHR     = 'C'
	C_SHT      = 's'
	C_USHT     = 'S'
	C_INT      = 'i'
	C_UINT     = 'I'
	C_LNG      = 'l'
	C_ULNG     = 'L'
	C_LNG_LNG  = 'q'
	C_ULNG_LNG = 'Q'
	C_FLT      = 'f'
	C_DBL      = 'd'
	C_BFLD     = 'b'
	C_BOOL     = 'B'
	C_VOID     = 'v'
	C_UNDEF    = '?'
	C_PTR      = '^'
	C_CHARPTR  = '*'
	C_ATOM     = '%'
	C_ARY_B    = '['
	C_ARY_E    = ']'
	C_UNION_B  = '('
	C_UNION_E  = ')'
	C_STRUCT_B = '{'
	C_STRUCT_E = '}'
	C_VECTOR   = '!'
	C_CONST    = 'r'
)
View Source
const (
	IsReplacement              ObjCImageInfoFlag = 1 << 0 // used for Fix&Continue, now ignored
	SupportsGC                 ObjCImageInfoFlag = 1 << 1 // image supports GC
	RequiresGC                 ObjCImageInfoFlag = 1 << 2 // image requires GC
	OptimizedByDyld            ObjCImageInfoFlag = 1 << 3 // image is from an optimized shared cache
	CorrectedSynthesize        ObjCImageInfoFlag = 1 << 4 // used for an old workaround, now ignored
	IsSimulated                ObjCImageInfoFlag = 1 << 5 // image compiled for a simulator platform
	HasCategoryClassProperties ObjCImageInfoFlag = 1 << 6 // New ABI: category_t.classProperties fields are present, Old ABI: Set by some compilers. Not used by the runtime.
	OptimizedByDyldClosure     ObjCImageInfoFlag = 1 << 7 // dyld (not the shared cache) optimized this.

	// 1 byte Swift unstable ABI version number
	SwiftUnstableVersionMaskShift = 8
	SwiftUnstableVersionMask      = 0xff << SwiftUnstableVersionMaskShift

	// 2 byte Swift stable ABI version number
	SwiftStableVersionMaskShift = 16
	SwiftStableVersionMask      = 0xffff << SwiftStableVersionMaskShift
)
View Source
const (
	// Values for protocol_t->flags
	PROTOCOL_FIXED_UP_2   = (1 << 31) // must never be set by compiler
	PROTOCOL_FIXED_UP_1   = (1 << 30) // must never be set by compiler
	PROTOCOL_IS_CANONICAL = (1 << 29) // must never be set by compiler
	// Bits 0..15 are reserved for Swift's use.
	PROTOCOL_FIXED_UP_MASK = (PROTOCOL_FIXED_UP_1 | PROTOCOL_FIXED_UP_2)
)
View Source
const (
	FAST_DATA_MASK   = 0xfffffffc
	FAST_DATA_MASK64 = 0x00007ffffffffff8
)
View Source
const (
	FAST_IS_SWIFT_LEGACY = 0x1 // < 5
	FAST_IS_SWIFT_STABLE = 0x2 // 5.X

	IsSwiftPreStableABI = 0x1
)
View Source
const IsDyldPreoptimized = 1 << 7
View Source
const REFERENCE_TYPE nListDesc = 0x7

Variables

This section is empty.

Functions

func DyldChainedPtrArm64eIsAuth added in v1.0.12

func DyldChainedPtrArm64eIsAuth(ptr uint64) bool

func DyldChainedPtrArm64eIsBind added in v1.0.12

func DyldChainedPtrArm64eIsBind(ptr uint64) bool

func DyldChainedPtrArm64eNext added in v1.0.12

func DyldChainedPtrArm64eNext(ptr uint64) uint64

func ExtractBits added in v1.0.10

func ExtractBits(x uint64, start, nbits int32) uint64

func KeyName added in v1.0.12

func KeyName(keyVal uint64) string

KeyName returns the chained pointer's key name

func MaskLSB64 added in v1.0.10

func MaskLSB64(x uint64, nbits uint8) uint64

func PutAtMost16Bytes added in v1.0.16

func PutAtMost16Bytes(b []byte, n string)

****** HELPERS *******

func RoundUp added in v1.0.16

func RoundUp(x, align uint64) uint64

func StringName added in v1.0.16

func StringName(i uint32, names []IntName, goSyntax bool) string

func StringName64 added in v1.0.16

func StringName64(i uint64, names []Int64Name, goSyntax bool) string

Types

type BuildToolVersion

type BuildToolVersion struct {
	Tool    Tool    /* enum for the tool */
	Version Version /* version number of the tool */
}

type BuildVersionCmd

type BuildVersionCmd struct {
	LoadCmd        /* LC_BUILD_VERSION */
	Len     uint32 /* sizeof(struct build_version_command) plus */
	/* ntools * sizeof(struct build_tool_version) */
	Platform Platform /* platform */
	Minos    Version  /* X.Y.Z is encoded in nibbles xxxx.yy.zz */
	Sdk      Version  /* X.Y.Z is encoded in nibbles xxxx.yy.zz */
	NumTools uint32   /* number of tool entries following this */
}

* The build_version_command contains the min OS version on which this * binary was built to run for its platform. The list of known platforms and * tool values following it.

type CPU

type CPU uint32

A CPU is a Mach-O cpu type.

const (
	CPU386     CPU = 7
	CPUAmd64   CPU = CPU386 | cpuArch64
	CPUArm     CPU = 12
	CPUArm64   CPU = CPUArm | cpuArch64
	CPUArm6432     = CPUArm | cpuArch6432
	CPUPpc     CPU = 18
	CPUPpc64   CPU = CPUPpc | cpuArch64
)

func (CPU) GoString

func (i CPU) GoString() string

func (CPU) String

func (i CPU) String() string

type CPUSubtype

type CPUSubtype uint32
const (
	// CPUSubtypeX86All   CPUSubtype = 3
	CPUSubtypeX8664All CPUSubtype = 3
	CPUSubtypeX86Arch1 CPUSubtype = 4
	CPUSubtypeX86_64H  CPUSubtype = 8
)

X86 subtypes

const (
	CPUSubtypeArmAll    CPUSubtype = 0
	CPUSubtypeArmV4T    CPUSubtype = 5
	CPUSubtypeArmV6     CPUSubtype = 6
	CPUSubtypeArmV5Tej  CPUSubtype = 7
	CPUSubtypeArmXscale CPUSubtype = 8
	CPUSubtypeArmV7     CPUSubtype = 9
	CPUSubtypeArmV7F    CPUSubtype = 10
	CPUSubtypeArmV7S    CPUSubtype = 11
	CPUSubtypeArmV7K    CPUSubtype = 12
	CPUSubtypeArmV8     CPUSubtype = 13
	CPUSubtypeArmV6M    CPUSubtype = 14
	CPUSubtypeArmV7M    CPUSubtype = 15
	CPUSubtypeArmV7Em   CPUSubtype = 16
	CPUSubtypeArmV8M    CPUSubtype = 17
)

ARM subtypes

const (
	CPUSubtypeArm64All CPUSubtype = 0
	CPUSubtypeArm64V8  CPUSubtype = 1
	CPUSubtypeArm64E   CPUSubtype = 2
)

ARM64 subtypes

func (CPUSubtype) GoString

func (st CPUSubtype) GoString(cpu CPU) string

func (CPUSubtype) String

func (st CPUSubtype) String(cpu CPU) string

type ClassRO64Type added in v1.0.12

type ClassRO64Type struct {
	Flags         ClassRoFlags
	InstanceStart uint32
	InstanceSize  uint64
	// _                    uint32
	IvarLayoutVmAddr     uint64
	NameVmAddr           uint64
	BaseMethodsVmAddr    uint64
	BaseProtocolsVmAddr  uint64
	IvarsVmAddr          uint64
	WeakIvarLayoutVmAddr uint64
	BasePropertiesVmAddr uint64
}

type ClassROType added in v1.0.12

type ClassROType struct {
	Flags         ClassRoFlags
	InstanceStart uint32
	InstanceSize  uint32

	IvarLayoutVmAddr     uint32
	NameVmAddr           uint32
	BaseMethodsVmAddr    uint32
	BaseProtocolsVmAddr  uint32
	IvarsVmAddr          uint32
	WeakIvarLayoutVmAddr uint32
	BasePropertiesVmAddr uint32
	// contains filtered or unexported fields
}

type ClassRoFlags added in v1.0.12

type ClassRoFlags uint32
const (
	// class is a metaclass
	RO_META ClassRoFlags = (1 << 0)
	// class is a root class
	RO_ROOT ClassRoFlags = (1 << 1)
	// class has .cxx_construct/destruct implementations
	RO_HAS_CXX_STRUCTORS ClassRoFlags = (1 << 2)
	// class has +load implementation
	RO_HAS_LOAD_METHOD ClassRoFlags = (1 << 3)
	// class has visibility=hidden set
	RO_HIDDEN ClassRoFlags = (1 << 4)
	// class has attributeClassRoFlags = (objc_exception): OBJC_EHTYPE_$_ThisClass is non-weak
	RO_EXCEPTION ClassRoFlags = (1 << 5)
	// class has ro field for Swift metadata initializer callback
	RO_HAS_SWIFT_INITIALIZER ClassRoFlags = (1 << 6)
	// class compiled with ARC
	RO_IS_ARC ClassRoFlags = (1 << 7)
	// class has .cxx_destruct but no .cxx_construct ClassRoFlags = (with RO_HAS_CXX_STRUCTORS)
	RO_HAS_CXX_DTOR_ONLY ClassRoFlags = (1 << 8)
	// class is not ARC but has ARC-style weak ivar layout
	RO_HAS_WEAK_WITHOUT_ARC ClassRoFlags = (1 << 9)
	// class does not allow associated objects on instances
	RO_FORBIDS_ASSOCIATED_OBJECTS ClassRoFlags = (1 << 10)
	// class is in an unloadable bundle - must never be set by compiler
	RO_FROM_BUNDLE ClassRoFlags = (1 << 29)
	// class is unrealized future class - must never be set by compiler
	RO_FUTURE ClassRoFlags = (1 << 30)
	// class is realized - must never be set by compiler
	RO_REALIZED ClassRoFlags = (1 << 31)
)

func (ClassRoFlags) HasCxxStructors added in v1.0.12

func (f ClassRoFlags) HasCxxStructors() bool

func (ClassRoFlags) IsMeta added in v1.0.12

func (f ClassRoFlags) IsMeta() bool

func (ClassRoFlags) IsRoot added in v1.0.12

func (f ClassRoFlags) IsRoot() bool

type CodeSignatureCmd

type CodeSignatureCmd LinkEditDataCmd // LC_CODE_SIGNATURE

A CodeSignatureCmd is a Mach-O code signature command.

type DCImportsFormat added in v1.0.10

type DCImportsFormat uint32

DCImportsFormat are values for dyld_chained_fixups_header.imports_format

const (
	DC_IMPORT          DCImportsFormat = 1
	DC_IMPORT_ADDEND   DCImportsFormat = 2
	DC_IMPORT_ADDEND64 DCImportsFormat = 3
)

type DCPtrKind added in v1.0.10

type DCPtrKind uint16

DCPtrKind are values for dyld_chained_starts_in_segment.pointer_format

const (
	DYLD_CHAINED_PTR_ARM64E              DCPtrKind = 1 // stride 8, unauth target is vmaddr
	DYLD_CHAINED_PTR_64                  DCPtrKind = 2 // target is vmaddr
	DYLD_CHAINED_PTR_32                  DCPtrKind = 3
	DYLD_CHAINED_PTR_32_CACHE            DCPtrKind = 4
	DYLD_CHAINED_PTR_32_FIRMWARE         DCPtrKind = 5
	DYLD_CHAINED_PTR_64_OFFSET           DCPtrKind = 6 // target is vm offset
	DYLD_CHAINED_PTR_ARM64E_OFFSET       DCPtrKind = 7 // old name
	DYLD_CHAINED_PTR_ARM64E_KERNEL       DCPtrKind = 7 // stride 4, unauth target is vm offset
	DYLD_CHAINED_PTR_64_KERNEL_CACHE     DCPtrKind = 8
	DYLD_CHAINED_PTR_ARM64E_USERLAND     DCPtrKind = 9  // stride 8, unauth target is vm offset
	DYLD_CHAINED_PTR_ARM64E_FIRMWARE     DCPtrKind = 10 // stride 4, unauth target is vmaddr
	DYLD_CHAINED_PTR_X86_64_KERNEL_CACHE DCPtrKind = 11 // stride 1, x86_64 kernel caches
	DYLD_CHAINED_PTR_ARM64E_USERLAND24   DCPtrKind = 12 // stride 8, unauth target is vm offset, 24-bit bind
)

type DCPtrStart added in v1.0.10

type DCPtrStart uint16
const (
	DYLD_CHAINED_PTR_START_NONE  DCPtrStart = 0xFFFF // used in page_start[] to denote a page with no fixups
	DYLD_CHAINED_PTR_START_MULTI DCPtrStart = 0x8000 // used in page_start[] to denote a page which has multiple starts
	DYLD_CHAINED_PTR_START_LAST  DCPtrStart = 0x8000 // used in chain_starts[] to denote last start in list for page
)

type DCSymbolsFormat added in v1.0.10

type DCSymbolsFormat uint32
const (
	DC_SFORMAT_UNCOMPRESSED    DCSymbolsFormat = 0
	DC_SFORMAT_ZLIB_COMPRESSED DCSymbolsFormat = 1
)

type DataInCodeCmd

type DataInCodeCmd LinkEditDataCmd // LC_DATA_IN_CODE

A DataInCodeCmd is a Mach-O data in code command.

type DataInCodeEntry

type DataInCodeEntry struct {
	Offset uint32
	Length uint16
	Kind   DiceKind
}

type DiceKind

type DiceKind uint16
const (
	KindData           DiceKind = 0x0001
	KindJumpTable8     DiceKind = 0x0002
	KindJumpTable16    DiceKind = 0x0003
	KindJumpTable32    DiceKind = 0x0004
	KindAbsJumpTable32 DiceKind = 0x0005
)

func (DiceKind) String

func (i DiceKind) String() string

type DyldChainedFixupsCmd

type DyldChainedFixupsCmd LinkEditDataCmd // LC_DYLD_CHAINED_FIXUPS

A DyldChainedFixupsCmd is used with linkedit_data_command command.

type DyldChainedFixupsHeader added in v1.0.10

type DyldChainedFixupsHeader struct {
	FixupsVersion uint32          // 0
	StartsOffset  uint32          // offset of DyldChainedStartsInImage in chain_data
	ImportsOffset uint32          // offset of imports table in chain_data
	SymbolsOffset uint32          // offset of symbol strings in chain_data
	ImportsCount  uint32          // number of imported symbol names
	ImportsFormat DCImportsFormat // DYLD_CHAINED_IMPORT*
	SymbolsFormat DCSymbolsFormat // 0 => uncompressed, 1 => zlib compressed
}

DyldChainedFixupsHeader object is the header of the LC_DYLD_CHAINED_FIXUPS payload

type DyldChainedImport added in v1.0.6

type DyldChainedImport uint32

DYLD_CHAINED_IMPORT

func (DyldChainedImport) LibOrdinal added in v1.0.12

func (d DyldChainedImport) LibOrdinal() uint8

func (DyldChainedImport) NameOffset added in v1.0.12

func (d DyldChainedImport) NameOffset() uint32

func (DyldChainedImport) WeakImport added in v1.0.12

func (d DyldChainedImport) WeakImport() bool

type DyldChainedImport64 added in v1.0.12

type DyldChainedImport64 uint64

func (DyldChainedImport64) LibOrdinal added in v1.0.12

func (d DyldChainedImport64) LibOrdinal() uint64

func (DyldChainedImport64) NameOffset added in v1.0.12

func (d DyldChainedImport64) NameOffset() uint64

func (DyldChainedImport64) Reserved added in v1.0.12

func (d DyldChainedImport64) Reserved() uint64

func (DyldChainedImport64) WeakImport added in v1.0.12

func (d DyldChainedImport64) WeakImport() bool

type DyldChainedImportAddend added in v1.0.10

type DyldChainedImportAddend struct {
	Import DyldChainedImport
	Addend int32
}

DYLD_CHAINED_IMPORT_ADDEND

type DyldChainedImportAddend64 added in v1.0.10

type DyldChainedImportAddend64 struct {
	Import DyldChainedImport64
	Addend uint64
}

DYLD_CHAINED_IMPORT_ADDEND64

type DyldChainedPtr32Bind added in v1.0.12

type DyldChainedPtr32Bind uint32

DYLD_CHAINED_PTR_32

func (DyldChainedPtr32Bind) Addend added in v1.0.12

func (d DyldChainedPtr32Bind) Addend() uint32

func (DyldChainedPtr32Bind) Bind added in v1.0.12

func (d DyldChainedPtr32Bind) Bind() uint32

func (DyldChainedPtr32Bind) Next added in v1.0.12

func (d DyldChainedPtr32Bind) Next() uint32

func (DyldChainedPtr32Bind) Ordinal added in v1.0.12

func (d DyldChainedPtr32Bind) Ordinal() uint32

func (DyldChainedPtr32Bind) String added in v1.0.12

func (d DyldChainedPtr32Bind) String() string

type DyldChainedPtr32CacheRebase added in v1.0.12

type DyldChainedPtr32CacheRebase uint32

DYLD_CHAINED_PTR_32_CACHE

func (DyldChainedPtr32CacheRebase) Next added in v1.0.12

func (DyldChainedPtr32CacheRebase) String added in v1.0.12

func (DyldChainedPtr32CacheRebase) Target added in v1.0.12

type DyldChainedPtr32FirmwareRebase added in v1.0.12

type DyldChainedPtr32FirmwareRebase uint32

DYLD_CHAINED_PTR_32_FIRMWARE

func (DyldChainedPtr32FirmwareRebase) Next added in v1.0.12

func (DyldChainedPtr32FirmwareRebase) String added in v1.0.12

func (DyldChainedPtr32FirmwareRebase) Target added in v1.0.12

type DyldChainedPtr32Rebase added in v1.0.12

type DyldChainedPtr32Rebase uint32

DYLD_CHAINED_PTR_32 Note: for DYLD_CHAINED_PTR_32 some non-pointer values are co-opted into the chain as out of range rebases. If an entry in the chain is > max_valid_pointer, then it is not a pointer. To restore the value, subtract off the bias, which is (64MB+max_valid_pointer)/2.

func (DyldChainedPtr32Rebase) Bind added in v1.0.12

func (d DyldChainedPtr32Rebase) Bind() uint32

func (DyldChainedPtr32Rebase) Next added in v1.0.12

func (d DyldChainedPtr32Rebase) Next() uint32

func (DyldChainedPtr32Rebase) String added in v1.0.12

func (d DyldChainedPtr32Rebase) String() string

func (DyldChainedPtr32Rebase) Target added in v1.0.12

func (d DyldChainedPtr32Rebase) Target() uint32

type DyldChainedPtr64Bind added in v1.0.12

type DyldChainedPtr64Bind uint64

DYLD_CHAINED_PTR_64

func (DyldChainedPtr64Bind) Addend added in v1.0.12

func (d DyldChainedPtr64Bind) Addend() uint64

func (DyldChainedPtr64Bind) Bind added in v1.0.12

func (d DyldChainedPtr64Bind) Bind() uint64

func (DyldChainedPtr64Bind) Next added in v1.0.12

func (d DyldChainedPtr64Bind) Next() uint64

func (DyldChainedPtr64Bind) Ordinal added in v1.0.12

func (d DyldChainedPtr64Bind) Ordinal() uint64

func (DyldChainedPtr64Bind) Reserved added in v1.0.12

func (d DyldChainedPtr64Bind) Reserved() uint64

func (DyldChainedPtr64Bind) String added in v1.0.12

func (d DyldChainedPtr64Bind) String() string

type DyldChainedPtr64KernelCacheRebase added in v1.0.12

type DyldChainedPtr64KernelCacheRebase uint64

DYLD_CHAINED_PTR_64_KERNEL_CACHE, DYLD_CHAINED_PTR_X86_64_KERNEL_CACHE

func (DyldChainedPtr64KernelCacheRebase) AddrDiv added in v1.0.12

func (DyldChainedPtr64KernelCacheRebase) CacheLevel added in v1.0.12

func (DyldChainedPtr64KernelCacheRebase) Diversity added in v1.0.12

func (DyldChainedPtr64KernelCacheRebase) IsAuth added in v1.0.12

func (DyldChainedPtr64KernelCacheRebase) Key added in v1.0.12

func (DyldChainedPtr64KernelCacheRebase) Next added in v1.0.12

func (DyldChainedPtr64KernelCacheRebase) String added in v1.0.12

func (DyldChainedPtr64KernelCacheRebase) Target added in v1.0.12

type DyldChainedPtr64Rebase added in v1.0.12

type DyldChainedPtr64Rebase uint64

DYLD_CHAINED_PTR_64

func (DyldChainedPtr64Rebase) Bind added in v1.0.12

func (d DyldChainedPtr64Rebase) Bind() uint64

func (DyldChainedPtr64Rebase) High8 added in v1.0.12

func (d DyldChainedPtr64Rebase) High8() uint64

func (DyldChainedPtr64Rebase) Next added in v1.0.12

func (d DyldChainedPtr64Rebase) Next() uint64

func (DyldChainedPtr64Rebase) Reserved added in v1.0.12

func (d DyldChainedPtr64Rebase) Reserved() uint64

func (DyldChainedPtr64Rebase) String added in v1.0.12

func (d DyldChainedPtr64Rebase) String() string

func (DyldChainedPtr64Rebase) Target added in v1.0.12

func (d DyldChainedPtr64Rebase) Target() uint64

func (DyldChainedPtr64Rebase) UnpackedTarget added in v1.0.12

func (d DyldChainedPtr64Rebase) UnpackedTarget() uint64

type DyldChainedPtr64RebaseOffset added in v1.0.12

type DyldChainedPtr64RebaseOffset uint64

DYLD_CHAINED_PTR_64_OFFSET

func (DyldChainedPtr64RebaseOffset) Bind added in v1.0.12

func (DyldChainedPtr64RebaseOffset) High8 added in v1.0.12

func (DyldChainedPtr64RebaseOffset) Next added in v1.0.12

func (DyldChainedPtr64RebaseOffset) Reserved added in v1.0.12

func (d DyldChainedPtr64RebaseOffset) Reserved() uint64

func (DyldChainedPtr64RebaseOffset) String added in v1.0.12

func (DyldChainedPtr64RebaseOffset) Target added in v1.0.12

func (DyldChainedPtr64RebaseOffset) UnpackedTarget added in v1.0.12

func (d DyldChainedPtr64RebaseOffset) UnpackedTarget() uint64

type DyldChainedPtrArm64eAuthBind added in v1.0.10

type DyldChainedPtrArm64eAuthBind uint64

DYLD_CHAINED_PTR_ARM64E

func (DyldChainedPtrArm64eAuthBind) AddrDiv added in v1.0.12

func (DyldChainedPtrArm64eAuthBind) Auth added in v1.0.12

func (DyldChainedPtrArm64eAuthBind) Bind added in v1.0.12

func (DyldChainedPtrArm64eAuthBind) Diversity added in v1.0.12

func (d DyldChainedPtrArm64eAuthBind) Diversity() uint64

func (DyldChainedPtrArm64eAuthBind) Key added in v1.0.12

func (DyldChainedPtrArm64eAuthBind) Next added in v1.0.12

func (DyldChainedPtrArm64eAuthBind) Ordinal added in v1.0.12

func (DyldChainedPtrArm64eAuthBind) String added in v1.0.12

func (DyldChainedPtrArm64eAuthBind) Zero added in v1.0.12

type DyldChainedPtrArm64eAuthBind24 added in v1.0.10

type DyldChainedPtrArm64eAuthBind24 uint64

DYLD_CHAINED_PTR_ARM64E_USERLAND24

func (DyldChainedPtrArm64eAuthBind24) AddrDiv added in v1.0.12

func (DyldChainedPtrArm64eAuthBind24) Auth added in v1.0.12

func (DyldChainedPtrArm64eAuthBind24) Bind added in v1.0.12

func (DyldChainedPtrArm64eAuthBind24) Diversity added in v1.0.12

func (d DyldChainedPtrArm64eAuthBind24) Diversity() uint64

func (DyldChainedPtrArm64eAuthBind24) Key added in v1.0.12

func (DyldChainedPtrArm64eAuthBind24) Next added in v1.0.12

func (DyldChainedPtrArm64eAuthBind24) Ordinal added in v1.0.12

func (DyldChainedPtrArm64eAuthBind24) String added in v1.0.12

func (DyldChainedPtrArm64eAuthBind24) Zero added in v1.0.12

type DyldChainedPtrArm64eAuthRebase added in v1.0.10

type DyldChainedPtrArm64eAuthRebase uint64

DYLD_CHAINED_PTR_ARM64E

func (DyldChainedPtrArm64eAuthRebase) AddrDiv added in v1.0.12

func (DyldChainedPtrArm64eAuthRebase) Auth added in v1.0.12

func (DyldChainedPtrArm64eAuthRebase) Bind added in v1.0.12

func (DyldChainedPtrArm64eAuthRebase) Diversity added in v1.0.12

func (d DyldChainedPtrArm64eAuthRebase) Diversity() uint64

func (DyldChainedPtrArm64eAuthRebase) Key added in v1.0.12

func (DyldChainedPtrArm64eAuthRebase) Next added in v1.0.12

func (DyldChainedPtrArm64eAuthRebase) String added in v1.0.12

func (DyldChainedPtrArm64eAuthRebase) Target added in v1.0.12

type DyldChainedPtrArm64eBind added in v1.0.10

type DyldChainedPtrArm64eBind uint64

DYLD_CHAINED_PTR_ARM64E

func (DyldChainedPtrArm64eBind) Addend added in v1.0.12

func (d DyldChainedPtrArm64eBind) Addend() uint64

func (DyldChainedPtrArm64eBind) Auth added in v1.0.12

func (DyldChainedPtrArm64eBind) Bind added in v1.0.12

func (DyldChainedPtrArm64eBind) Next added in v1.0.12

func (DyldChainedPtrArm64eBind) Ordinal added in v1.0.12

func (d DyldChainedPtrArm64eBind) Ordinal() uint64

func (DyldChainedPtrArm64eBind) String added in v1.0.12

func (d DyldChainedPtrArm64eBind) String() string

func (DyldChainedPtrArm64eBind) Zero added in v1.0.12

type DyldChainedPtrArm64eBind24 added in v1.0.10

type DyldChainedPtrArm64eBind24 uint64

DYLD_CHAINED_PTR_ARM64E_USERLAND24

func (DyldChainedPtrArm64eBind24) Addend added in v1.0.12

func (DyldChainedPtrArm64eBind24) Auth added in v1.0.12

func (DyldChainedPtrArm64eBind24) Bind added in v1.0.12

func (DyldChainedPtrArm64eBind24) Next added in v1.0.12

func (DyldChainedPtrArm64eBind24) Ordinal added in v1.0.12

func (d DyldChainedPtrArm64eBind24) Ordinal() uint64

func (DyldChainedPtrArm64eBind24) String added in v1.0.12

func (DyldChainedPtrArm64eBind24) Zero added in v1.0.12

type DyldChainedPtrArm64eRebase added in v1.0.10

type DyldChainedPtrArm64eRebase uint64

DYLD_CHAINED_PTR_ARM64E

func (DyldChainedPtrArm64eRebase) Auth added in v1.0.10

func (DyldChainedPtrArm64eRebase) Bind added in v1.0.10

func (DyldChainedPtrArm64eRebase) High8 added in v1.0.10

func (DyldChainedPtrArm64eRebase) Next added in v1.0.10

func (DyldChainedPtrArm64eRebase) String added in v1.0.12

func (DyldChainedPtrArm64eRebase) Target added in v1.0.10

func (DyldChainedPtrArm64eRebase) UnpackedTarget added in v1.0.12

func (d DyldChainedPtrArm64eRebase) UnpackedTarget() uint64

type DyldChainedStartsInImage added in v1.0.10

type DyldChainedStartsInImage struct {
	SegCount       uint32
	SegInfoOffset1 uint32 // []uint32 ARRAY each entry is offset into this struct for that segment

}

DyldChainedStartsInImage this struct is embedded in LC_DYLD_CHAINED_FIXUPS payload

type DyldChainedStartsInSegment added in v1.0.6

type DyldChainedStartsInSegment struct {
	Size            uint32    // size of this (amount kernel needs to copy)
	PageSize        uint16    // 0x1000 or 0x4000
	PointerFormat   DCPtrKind // DYLD_CHAINED_PTR_*
	SegmentOffset   uint64    // offset in memory to start of segment
	MaxValidPointer uint32    // for 32-bit OS, any value beyond this is not a pointer
	PageCount       uint16    // how many pages are in array

}

DyldChainedStartsInSegment object is embedded in dyld_chain_starts_in_image and passed down to the kernel for page-in linking

type DyldEnvironmentCmd

type DyldEnvironmentCmd DylinkerCmd // LC_DYLD_ENVIRONMENT

A DyldEnvironmentCmd is a Mach-O string for dyld to treat like environment variable command.

type DyldExportsTrieCmd

type DyldExportsTrieCmd LinkEditDataCmd // LC_DYLD_EXPORTS_TRIE

A DyldExportsTrieCmd is used with linkedit_data_command, payload is trie command.

type DyldInfoCmd

type DyldInfoCmd struct {
	LoadCmd      // LC_DYLD_INFO
	Len          uint32
	RebaseOff    uint32 // file offset to rebase info
	RebaseSize   uint32 //  size of rebase info
	BindOff      uint32 // file offset to binding info
	BindSize     uint32 // size of binding info
	WeakBindOff  uint32 // file offset to weak binding info
	WeakBindSize uint32 //  size of weak binding info
	LazyBindOff  uint32 // file offset to lazy binding info
	LazyBindSize uint32 //  size of lazy binding info
	ExportOff    uint32 // file offset to export info
	ExportSize   uint32 //  size of export info
}

A DyldInfoCmd is a Mach-O id dyld info command.

type DyldInfoOnlyCmd

type DyldInfoOnlyCmd DyldInfoCmd // LC_DYLD_INFO_ONLY

A DyldInfoOnlyCmd is a Mach-O compressed dyld information only command.

type DylibCmd

type DylibCmd struct {
	LoadCmd        // LC_LOAD_DYLIB
	Len            uint32
	Name           uint32
	Time           uint32
	CurrentVersion Version
	CompatVersion  Version
}

A DylibCmd is a Mach-O load dynamic library command. LC_ID_DYLIB, LC_LOAD_{,WEAK_}DYLIB,LC_REEXPORT_DYLIB

type DylibCodeSignDrsCmd

type DylibCodeSignDrsCmd LinkEditDataCmd // LC_DYLIB_CODE_SIGN_DRS

A DylibCodeSignDrsCmd is a Mach-O code signing DRs copied from linked dylibs command.

type DylibID

type DylibID DylibCmd // LC_ID_DYLIB

A DylibID represents a Mach-O load dynamic library ident command.

type DylinkerCmd

type DylinkerCmd struct {
	LoadCmd // LC_LOAD_DYLINKER
	Len     uint32
	Name    uint32 // dynamic linker's path name
}

A DylinkerCmd is a Mach-O dynamic load a dynamic linker command.

type DylinkerIDCmd

type DylinkerIDCmd DylinkerCmd // LC_ID_DYLINKER

A DylinkerIDCmd is a Mach-O dynamic linker identification command.

type DysymtabCmd

type DysymtabCmd struct {
	LoadCmd        // LC_DYSYMTAB
	Len            uint32
	Ilocalsym      uint32
	Nlocalsym      uint32
	Iextdefsym     uint32
	Nextdefsym     uint32
	Iundefsym      uint32
	Nundefsym      uint32
	Tocoffset      uint32
	Ntoc           uint32
	Modtaboff      uint32
	Nmodtab        uint32
	Extrefsymoff   uint32
	Nextrefsyms    uint32
	Indirectsymoff uint32
	Nindirectsyms  uint32
	Extreloff      uint32
	Nextrel        uint32
	Locreloff      uint32
	Nlocrel        uint32
}

A DysymtabCmd is a Mach-O dynamic symbol table command.

type EncryptionInfo64Cmd

type EncryptionInfo64Cmd struct {
	LoadCmd // LC_ENCRYPTION_INFO_64
	Len     uint32
	Offset  uint32           // file offset of encrypted range
	Size    uint32           // file size of encrypted range
	CryptID EncryptionSystem // which enryption system, 0 means not-encrypted yet
	Pad     uint32           // padding to make this struct's size a multiple of 8 bytes
}

A EncryptionInfo64Cmd is a Mach-O 64-bit encrypted segment information command.

type EncryptionInfoCmd

type EncryptionInfoCmd struct {
	LoadCmd // LC_ENCRYPTION_INFO
	Len     uint32
	Offset  uint32 // file offset of encrypted range
	Size    uint32 // file size of encrypted range
	CryptID uint32 // which enryption system, 0 means not-encrypted yet
}

A EncryptionInfoCmd is a Mach-O encrypted segment information command.

type EncryptionSystem added in v1.0.6

type EncryptionSystem uint32
const NOT_ENCRYPTED_YET EncryptionSystem = 0

type EntryPointCmd

type EntryPointCmd struct {
	LoadCmd          // LC_MAIN only used in MH_EXECUTE filetypes
	Len       uint32 // 24
	Offset    uint64 // file (__TEXT) offset of main()
	StackSize uint64 // if not zero, initial stack size
}

A EntryPointCmd is a Mach-O main command.

type FileHeader

type FileHeader struct {
	Magic        Magic
	CPU          CPU
	SubCPU       CPUSubtype
	Type         HeaderType
	NCommands    uint32
	SizeCommands uint32
	Flags        HeaderFlag
}

A FileHeader represents a Mach-O file header.

func (*FileHeader) Put

func (h *FileHeader) Put(b []byte, o binary.ByteOrder) int

func (FileHeader) String

func (h FileHeader) String() string

type FilePointer added in v1.0.12

type FilePointer struct {
	VMAdder uint64
	Offset  uint64
}

type FilesetEntryCmd added in v1.0.6

type FilesetEntryCmd struct {
	LoadCmd  // LC_FILESET_ENTRY
	Len      uint32
	Addr     uint64 // memory address of the entry
	Offset   uint64 // file offset of the entry
	EntryID  uint32 // contained entry id
	Reserved uint32 // reserved
}

FilesetEntryCmd commands describe constituent Mach-O files that are part of a fileset. In one implementation, entries are dylibs with individual mach headers and repositionable text and data segments. Each entry is further described by its own mach header.

type FunctionStartsCmd

type FunctionStartsCmd LinkEditDataCmd // LC_FUNCTION_STARTS

A FunctionStartsCmd is a Mach-O compressed table of function start addresses command.

type FvmFileCmd

type FvmFileCmd struct {
	LoadCmd    // LC_FVMFILE
	Len        uint32
	Name       uint32 // files pathname
	HeaderAddr uint32 // files virtual address
}

A FvmFileCmd is a Mach-O fixed VM file inclusion (internal use) command.

type HeaderFlag

type HeaderFlag uint32
const (
	NoUndefs                   HeaderFlag = 0x1
	IncrLink                   HeaderFlag = 0x2
	DyldLink                   HeaderFlag = 0x4
	BindAtLoad                 HeaderFlag = 0x8
	Prebound                   HeaderFlag = 0x10
	SplitSegs                  HeaderFlag = 0x20
	LazyInit                   HeaderFlag = 0x40
	TwoLevel                   HeaderFlag = 0x80
	ForceFlat                  HeaderFlag = 0x100
	NoMultiDefs                HeaderFlag = 0x200
	NoFixPrebinding            HeaderFlag = 0x400
	Prebindable                HeaderFlag = 0x800
	AllModsBound               HeaderFlag = 0x1000
	SubsectionsViaSymbols      HeaderFlag = 0x2000
	Canonical                  HeaderFlag = 0x4000
	WeakDefines                HeaderFlag = 0x8000
	BindsToWeak                HeaderFlag = 0x10000
	AllowStackExecution        HeaderFlag = 0x20000
	RootSafe                   HeaderFlag = 0x40000
	SetuidSafe                 HeaderFlag = 0x80000
	NoReexportedDylibs         HeaderFlag = 0x100000
	PIE                        HeaderFlag = 0x200000
	DeadStrippableDylib        HeaderFlag = 0x400000
	HasTLVDescriptors          HeaderFlag = 0x800000
	NoHeapExecution            HeaderFlag = 0x1000000
	AppExtensionSafe           HeaderFlag = 0x2000000
	NlistOutofsyncWithDyldinfo HeaderFlag = 0x4000000
	SimSupport                 HeaderFlag = 0x8000000
	DylibInCache               HeaderFlag = 0x80000000
)

func (HeaderFlag) AllModsBound

func (f HeaderFlag) AllModsBound() bool

func (HeaderFlag) AllowStackExecution

func (f HeaderFlag) AllowStackExecution() bool

func (HeaderFlag) AppExtensionSafe

func (f HeaderFlag) AppExtensionSafe() bool

func (HeaderFlag) BindAtLoad

func (f HeaderFlag) BindAtLoad() bool

func (HeaderFlag) BindsToWeak

func (f HeaderFlag) BindsToWeak() bool

func (HeaderFlag) Canonical

func (f HeaderFlag) Canonical() bool

func (HeaderFlag) DeadStrippableDylib

func (f HeaderFlag) DeadStrippableDylib() bool
func (f HeaderFlag) DyldLink() bool

func (HeaderFlag) DylibInCache

func (f HeaderFlag) DylibInCache() bool

func (HeaderFlag) Flags

func (f HeaderFlag) Flags() string

func (HeaderFlag) ForceFlat

func (f HeaderFlag) ForceFlat() bool

func (HeaderFlag) HasTLVDescriptors

func (f HeaderFlag) HasTLVDescriptors() bool
func (f HeaderFlag) IncrLink() bool

func (HeaderFlag) LazyInit

func (f HeaderFlag) LazyInit() bool

func (HeaderFlag) List

func (f HeaderFlag) List() []string

List returns a string array of flag names

func (HeaderFlag) NlistOutofsyncWithDyldinfo

func (f HeaderFlag) NlistOutofsyncWithDyldinfo() bool

func (HeaderFlag) NoFixPrebinding

func (f HeaderFlag) NoFixPrebinding() bool

func (HeaderFlag) NoHeapExecution

func (f HeaderFlag) NoHeapExecution() bool

func (HeaderFlag) NoMultiDefs

func (f HeaderFlag) NoMultiDefs() bool

func (HeaderFlag) NoReexportedDylibs

func (f HeaderFlag) NoReexportedDylibs() bool

func (HeaderFlag) NoUndefs

func (f HeaderFlag) NoUndefs() bool

GETTERS

func (HeaderFlag) PIE

func (f HeaderFlag) PIE() bool

func (HeaderFlag) Prebindable

func (f HeaderFlag) Prebindable() bool

func (HeaderFlag) Prebound

func (f HeaderFlag) Prebound() bool

func (HeaderFlag) RootSafe

func (f HeaderFlag) RootSafe() bool

func (*HeaderFlag) Set

func (f *HeaderFlag) Set(flag HeaderFlag, set bool)

SETTER

func (HeaderFlag) SetuidSafe

func (f HeaderFlag) SetuidSafe() bool

func (HeaderFlag) SimSupport

func (f HeaderFlag) SimSupport() bool

func (HeaderFlag) SplitSegs

func (f HeaderFlag) SplitSegs() bool

func (HeaderFlag) String

func (i HeaderFlag) String() string

func (HeaderFlag) SubsectionsViaSymbols

func (f HeaderFlag) SubsectionsViaSymbols() bool

func (HeaderFlag) TwoLevel

func (f HeaderFlag) TwoLevel() bool

func (HeaderFlag) WeakDefines

func (f HeaderFlag) WeakDefines() bool

type HeaderType

type HeaderType uint32

A HeaderType is the Mach-O file type, e.g. an object file, executable, or dynamic library.

const (
	Obj        HeaderType = 1
	Exec       HeaderType = 2
	FVMLib     HeaderType = 3
	Core       HeaderType = 4
	Preload    HeaderType = 5 /* preloaded executable file */
	Dylib      HeaderType = 6 /* dynamically bound shared library */
	Dylinker   HeaderType = 7 /* dynamic link editor */
	Bundle     HeaderType = 8
	DylibStub  HeaderType = 0x9 /* shared library stub for static */
	Dsym       HeaderType = 0xa /* companion file with only debug */
	KextBundle HeaderType = 0xb /* x86_64 kexts */
)

func (HeaderType) String

func (i HeaderType) String() string

type IDFvmLibCmd

type IDFvmLibCmd LoadFvmLibCmd // LC_IDFVMLIB

A IDFvmLibCmd is a Mach-O fixed VM shared library identification command.

type IdentCmd

type IdentCmd struct {
	LoadCmd // LC_IDENT
	Len     uint32
}

A IdentCmd is a Mach-O object identification info (obsolete) command.

type Int64Name added in v1.0.16

type Int64Name struct {
	I uint64
	S string
}

type IntName added in v1.0.16

type IntName struct {
	I uint32
	S string
}

type LazyLoadDylibCmd

type LazyLoadDylibCmd DylibCmd // LC_LAZY_LOAD_DYLIB

A LazyLoadDylibCmd is a Mach-O delay load of dylib until first use command.

type LinkEditDataCmd

type LinkEditDataCmd struct {
	LoadCmd
	Len    uint32
	Offset uint32
	Size   uint32
}

A LinkEditDataCmd is a Mach-O linkedit data command.

type LinkerOptimizationHintCmd

type LinkerOptimizationHintCmd LinkEditDataCmd // LC_LINKER_OPTIMIZATION_HINT

A LinkerOptimizationHintCmd is a Mach-O optimization hints command.

type LinkerOptionCmd

type LinkerOptionCmd struct {
	LoadCmd // LC_LINKER_OPTION only used in MH_OBJECT filetypes
	Len     uint32
	Count   uint32 // number of strings concatenation of zero terminated UTF8 strings. Zero filled at end to align
}

A LinkerOptionCmd is a Mach-O main command.

type LoadCmd

type LoadCmd uint32

A LoadCmd is a Mach-O load command.

const (
	LC_REQ_DYLD       LoadCmd = 0x80000000
	LC_SEGMENT        LoadCmd = 0x1  // segment of this file to be mapped
	LC_SYMTAB         LoadCmd = 0x2  // link-edit stab symbol table info
	LC_SYMSEG         LoadCmd = 0x3  // link-edit gdb symbol table info (obsolete)
	LC_THREAD         LoadCmd = 0x4  // thread
	LC_UNIXTHREAD     LoadCmd = 0x5  // thread+stack
	LC_LOADFVMLIB     LoadCmd = 0x6  // load a specified fixed VM shared library
	LC_IDFVMLIB       LoadCmd = 0x7  // fixed VM shared library identification
	LC_IDENT          LoadCmd = 0x8  // object identification info (obsolete)
	LC_FVMFILE        LoadCmd = 0x9  // fixed VM file inclusion (internal use)
	LC_PREPAGE        LoadCmd = 0xa  // prepage command (internal use)
	LC_DYSYMTAB       LoadCmd = 0xb  // dynamic link-edit symbol table info
	LC_LOAD_DYLIB     LoadCmd = 0xc  // load dylib command
	LC_ID_DYLIB       LoadCmd = 0xd  // id dylib command
	LC_LOAD_DYLINKER  LoadCmd = 0xe  // load a dynamic linker
	LC_ID_DYLINKER    LoadCmd = 0xf  // id dylinker command (not load dylinker command)
	LC_PREBOUND_DYLIB LoadCmd = 0x10 // modules prebound for a dynamically linked shared library
	LC_ROUTINES       LoadCmd = 0x11 // image routines
	LC_SUB_FRAMEWORK  LoadCmd = 0x12 // sub framework
	LC_SUB_UMBRELLA   LoadCmd = 0x13 // sub umbrella
	LC_SUB_CLIENT     LoadCmd = 0x14 // sub client
	LC_SUB_LIBRARY    LoadCmd = 0x15 // sub library
	LC_TWOLEVEL_HINTS LoadCmd = 0x16 // two-level namespace lookup hints
	LC_PREBIND_CKSUM  LoadCmd = 0x17 // prebind checksum
	/*
	 * load a dynamically linked shared library that is allowed to be missing
	 * (all symbols are weak imported).
	 */
	LC_LOAD_WEAK_DYLIB          LoadCmd = (0x18 | LC_REQ_DYLD)
	LC_SEGMENT_64               LoadCmd = 0x19                 // 64-bit segment of this file to be mapped
	LC_ROUTINES_64              LoadCmd = 0x1a                 // 64-bit image routines
	LC_UUID                     LoadCmd = 0x1b                 // the uuid
	LC_RPATH                    LoadCmd = (0x1c | LC_REQ_DYLD) // runpath additions
	LC_CODE_SIGNATURE           LoadCmd = 0x1d                 // local of code signature
	LC_SEGMENT_SPLIT_INFO       LoadCmd = 0x1e                 // local of info to split segments
	LC_REEXPORT_DYLIB           LoadCmd = (0x1f | LC_REQ_DYLD) // load and re-export dylib
	LC_LAZY_LOAD_DYLIB          LoadCmd = 0x20                 // delay load of dylib until first use
	LC_ENCRYPTION_INFO          LoadCmd = 0x21                 // encrypted segment information
	LC_DYLD_INFO                LoadCmd = 0x22                 // compressed dyld information
	LC_DYLD_INFO_ONLY           LoadCmd = (0x22 | LC_REQ_DYLD) // compressed dyld information only
	LC_LOAD_UPWARD_DYLIB        LoadCmd = (0x23 | LC_REQ_DYLD) // load upward dylib
	LC_VERSION_MIN_MACOSX       LoadCmd = 0x24                 // build for MacOSX min OS version
	LC_VERSION_MIN_IPHONEOS     LoadCmd = 0x25                 // build for iPhoneOS min OS version
	LC_FUNCTION_STARTS          LoadCmd = 0x26                 // compressed table of function start addresses
	LC_DYLD_ENVIRONMENT         LoadCmd = 0x27                 // string for dyld to treat like environment variable
	LC_MAIN                     LoadCmd = (0x28 | LC_REQ_DYLD) // replacement for LC_UNIXTHREAD
	LC_DATA_IN_CODE             LoadCmd = 0x29                 // table of non-instructions in __text
	LC_SOURCE_VERSION           LoadCmd = 0x2A                 // source version used to build binary
	LC_DYLIB_CODE_SIGN_DRS      LoadCmd = 0x2B                 // Code signing DRs copied from linked dylibs
	LC_ENCRYPTION_INFO_64       LoadCmd = 0x2C                 // 64-bit encrypted segment information
	LC_LINKER_OPTION            LoadCmd = 0x2D                 // linker options in MH_OBJECT files
	LC_LINKER_OPTIMIZATION_HINT LoadCmd = 0x2E                 // optimization hints in MH_OBJECT files
	LC_VERSION_MIN_TVOS         LoadCmd = 0x2F                 // build for AppleTV min OS version
	LC_VERSION_MIN_WATCHOS      LoadCmd = 0x30                 // build for Watch min OS version
	LC_NOTE                     LoadCmd = 0x31                 // arbitrary data included within a Mach-O file
	LC_BUILD_VERSION            LoadCmd = 0x32                 // build for platform min OS version
	LC_DYLD_EXPORTS_TRIE        LoadCmd = (0x33 | LC_REQ_DYLD) // used with linkedit_data_command, payload is trie
	LC_DYLD_CHAINED_FIXUPS      LoadCmd = (0x34 | LC_REQ_DYLD) // used with linkedit_data_command
	LC_FILESET_ENTRY            LoadCmd = (0x35 | LC_REQ_DYLD) /* used with fileset_entry_command */
)

func (LoadCmd) Command

func (c LoadCmd) Command() LoadCmd

func (LoadCmd) Put

func (c LoadCmd) Put(b []byte, o binary.ByteOrder) int

func (LoadCmd) String

func (i LoadCmd) String() string

type LoadFvmLibCmd

type LoadFvmLibCmd struct {
	LoadCmd      // LC_IDFVMLIB or LC_LOADFVMLIB
	Len          uint32
	Name         uint32 // library's target pathname
	MinorVersion uint32
	HeaderAddr   uint32
}

A LoadFvmLibCmd is a Mach-O load a specified fixed VM shared library command.

type MLFlags added in v1.0.12

type MLFlags uint32
const (
	METHOD_LIST_FLAGS_MASK         = 3
	METHOD_LIST_IS_UNIQUED MLFlags = 1
	METHOD_LIST_FIXED_UP   MLFlags = 3
)

type Magic

type Magic uint32
const (
	Magic32  Magic = 0xfeedface
	Magic64  Magic = 0xfeedfacf
	MagicFat Magic = 0xcafebabe
)

func (Magic) GoString

func (i Magic) GoString() string

func (Magic) Int

func (i Magic) Int() uint32

func (Magic) String

func (i Magic) String() string

type Method2Type added in v1.0.12

type Method2Type struct {
	NameOffset  uint32 // SEL
	TypesOffset uint32 // const char *
	ImpOffset   uint32 // IMP
}

type MethodListType added in v1.0.12

type MethodListType struct {
	EntSizeAndFlags uint32
	Count           uint32
}

func (MethodListType) EntSize added in v1.0.12

func (ml MethodListType) EntSize() uint32

func (MethodListType) FixedUp added in v1.0.12

func (ml MethodListType) FixedUp() bool

func (MethodListType) IsUniqued added in v1.0.12

func (ml MethodListType) IsUniqued() bool

type MethodType added in v1.0.12

type MethodType struct {
	NameVMAddr  uint64 // SEL
	TypesVMAddr uint64 // const char *
	ImpVMAddr   uint64 // IMP
}

type NLType

type NLType uint8
const (
	N_STAB NLType = 0xe0 /* if any of these bits set, a symbolic debugging entry */
	N_PEXT NLType = 0x10 /* private external symbol bit */
	N_TYPE NLType = 0x0e /* mask for the type bits */
	N_EXT  NLType = 0x01 /* external symbol bit, set for external symbols */
)

* The n_type field really contains four fields: * unsigned char N_STAB:3, * N_PEXT:1, * N_TYPE:3, * N_EXT:1; * which are used via the following masks.

const (
	N_UNDF NLType = 0x0 /* undefined, n_sect == NO_SECT */
	N_ABS  NLType = 0x2 /* absolute, n_sect == NO_SECT */
	N_SECT NLType = 0xe /* defined in section number n_sect */
	N_PBUD NLType = 0xc /* prebound undefined (defined in a dylib) */
	N_INDR NLType = 0xa /* indirect */
)

* Values for N_TYPE bits of the n_type field.

func (NLType) IsAbsoluteSym

func (t NLType) IsAbsoluteSym() bool

func (NLType) IsDebugSym

func (t NLType) IsDebugSym() bool

func (NLType) IsDefinedInSection

func (t NLType) IsDefinedInSection() bool

func (NLType) IsExternalSym

func (t NLType) IsExternalSym() bool

func (NLType) IsIndirectSym

func (t NLType) IsIndirectSym() bool

func (NLType) IsPreboundUndefinedSym

func (t NLType) IsPreboundUndefinedSym() bool

func (NLType) IsPrivateExternalSym

func (t NLType) IsPrivateExternalSym() bool

func (NLType) IsUndefinedSym

func (t NLType) IsUndefinedSym() bool

func (NLType) String

func (t NLType) String(secName string) string

type Nlist32

type Nlist32 struct {
	Name  uint32
	Type  NLType
	Sect  uint8
	Desc  uint16
	Value uint32
}

An Nlist32 is a Mach-O 32-bit symbol table entry.

func (*Nlist32) Put32 added in v1.0.4

func (n *Nlist32) Put32(b []byte, o binary.ByteOrder) uint32

type Nlist64

type Nlist64 struct {
	Name  uint32
	Type  NLType
	Sect  uint8
	Desc  uint16
	Value uint64
}

An Nlist64 is a Mach-O 64-bit symbol table entry.

func (*Nlist64) Put64

func (n *Nlist64) Put64(b []byte, o binary.ByteOrder) uint32

type NoteCmd

type NoteCmd struct {
	LoadCmd   // LC_NOTE
	Len       uint32
	DataOwner [16]byte
	Offset    uint64
	Size      uint64
}

A NoteCmd is a Mach-O note command.

type ObjCCategory added in v1.0.12

type ObjCCategory struct {
	Name string
	ObjCCategoryType
}

type ObjCCategoryType added in v1.0.12

type ObjCCategoryType struct {
	NameVMAddr               uint64
	ClsVMAddr                uint64
	InstanceMethodsVMAddr    uint64
	ClassMethodsVMAddr       uint64
	ProtocolsVMAddr          uint64
	InstancePropertiesVMAddr uint64
}

type ObjCClass added in v1.0.12

type ObjCClass struct {
	Name                  string
	SuperClass            *ObjCClass
	InstanceMethods       []ObjCMethod
	Ivars                 []ObjCIvar
	ClassPtr              FilePointer
	IsaVmAddr             uint64
	SuperclassVmAddr      uint64
	MethodCacheBuckets    uint64
	MethodCacheProperties uint64
	DataVMAddr            uint64
	IsSwiftLegacy         bool
	IsSwiftStable         bool
	ReadOnlyData          ClassRO64Type
}

func (*ObjCClass) String added in v1.0.12

func (c *ObjCClass) String() string

type ObjCImageInfo added in v1.0.12

type ObjCImageInfo struct {
	Version uint32
	Flags   ObjCImageInfoFlag
}

type ObjCImageInfoFlag added in v1.0.12

type ObjCImageInfoFlag uint32

func (ObjCImageInfoFlag) SwiftVersion added in v1.0.12

func (f ObjCImageInfoFlag) SwiftVersion() string

type ObjCInfo added in v1.0.12

type ObjCInfo struct {
	SelRefCount      uint64
	ClassDefCount    uint64
	ProtocolDefCount uint64
}

type ObjCIvar added in v1.0.12

type ObjCIvar struct {
	Name string
	Type string
	ObjCIvarType
}

type ObjCIvarListType added in v1.0.12

type ObjCIvarListType struct {
	EntSize uint32
	Count   uint32
}

type ObjCIvarType added in v1.0.12

type ObjCIvarType struct {
	Offset      uint64 // uint32_t*  (uint64_t* on x86_64)
	NameVMAddr  uint64 // const char*
	TypesVMAddr uint64 // const char*
	Alignment   uint32
	Size        uint32
}

type ObjCMethod added in v1.0.12

type ObjCMethod struct {
	NameVMAddr  uint64 // & SEL
	TypesVMAddr uint64 // & const char *
	ImpVMAddr   uint64 // & IMP

	// We also need to know where the reference to the nameVMAddr was
	// This is so that we know how to rebind that location
	NameLocationVMAddr uint64
	Name               string
	Types              string
	Pointer            FilePointer
}

type ObjCProperty added in v1.0.12

type ObjCProperty struct {
	ObjCPropertyT
	Name       string
	Attributes string
}

type ObjCPropertyListT added in v1.0.12

type ObjCPropertyListT struct {
	EntSize uint32
	Count   uint32
}

type ObjCPropertyT added in v1.0.12

type ObjCPropertyT struct {
	NameVMAddr       uint64
	AttributesVMAddr uint64
}

type ObjCProtocol added in v1.0.12

type ObjCProtocol struct {
	Name                    string
	InstanceMethods         []ObjCMethod
	InstanceProperties      []ObjCProperty
	ClassMethods            []ObjCMethod
	OptionalInstanceMethods []ObjCMethod
	OptionalClassMethods    []ObjCMethod
	ExtendedMethodTypes     string
	DemangledName           string
	ProtocolType
}

func (*ObjCProtocol) String added in v1.0.12

func (p *ObjCProtocol) String() string

type ObjcClass64Type added in v1.0.12

type ObjcClass64Type struct {
	IsaVmAddr              uint64
	SuperclassVmAddr       uint64
	MethodCacheBuckets     uint64
	MethodCacheProperties  uint64
	DataVmAddrAndFastFlags uint64
}

type ObjcClassType added in v1.0.12

type ObjcClassType struct {
	IsaVmAddr              uint32
	SuperclassVmAddr       uint32
	MethodCacheBuckets     uint32
	MethodCacheProperties  uint32
	DataVmAddrAndFastFlags uint32
}

type Platform

type Platform uint32

Platform is a macho platform object

func (Platform) String

func (i Platform) String() string

type PrePageCmd

type PrePageCmd interface{} // LC_PREPAGE

A PrePageCmd is a Mach-O prepage command (internal use) command.

type PrebindCksumCmd

type PrebindCksumCmd struct {
	LoadCmd  // LC_PREBIND_CKSUM
	Len      uint32
	CheckSum uint32
}

A PrebindCksumCmd is a Mach-O prebind checksum command.

type PreboundDylibCmd

type PreboundDylibCmd struct {
	LoadCmd       // LC_PREBOUND_DYLIB
	Len           uint32
	Name          uint32 // library's path name
	NumModules    uint32 // number of modules in library
	LinkedModules uint32 // bit vector of linked modules
}

PreboundDylibCmd are modules prebound for a dynamically linked shared library

type ProtocolType added in v1.0.12

type ProtocolType struct {
	IsaVMAddr                     uint64
	NameVMAddr                    uint64
	ProtocolsVMAddr               uint64
	InstanceMethodsVMAddr         uint64
	ClassMethodsVMAddr            uint64
	OptionalInstanceMethodsVMAddr uint64
	OptionalClassMethodsVMAddr    uint64
	InstancePropertiesVMAddr      uint64
	Size                          uint32
	Flags                         uint32
	// Fields below this point are not always present on disk.
	ExtendedMethodTypesVMAddr uint64
	DemangledNameVMAddr       uint64
	ClassPropertiesVMAddr     uint64
}

type ReExportDylibCmd

type ReExportDylibCmd DylibCmd // LC_REEXPORT_DYLIB

A ReExportDylibCmd is a Mach-O load and re-export dylib command.

type RelocTypeARM

type RelocTypeARM int
const (
	ARM_RELOC_VANILLA        RelocTypeARM = 0
	ARM_RELOC_PAIR           RelocTypeARM = 1
	ARM_RELOC_SECTDIFF       RelocTypeARM = 2
	ARM_RELOC_LOCAL_SECTDIFF RelocTypeARM = 3
	ARM_RELOC_PB_LA_PTR      RelocTypeARM = 4
	ARM_RELOC_BR24           RelocTypeARM = 5
	ARM_THUMB_RELOC_BR22     RelocTypeARM = 6
	ARM_THUMB_32BIT_BRANCH   RelocTypeARM = 7
	ARM_RELOC_HALF           RelocTypeARM = 8
	ARM_RELOC_HALF_SECTDIFF  RelocTypeARM = 9
)

func (RelocTypeARM) GoString

func (r RelocTypeARM) GoString() string

func (RelocTypeARM) String

func (i RelocTypeARM) String() string

type RelocTypeARM64

type RelocTypeARM64 int
const (
	ARM64_RELOC_UNSIGNED            RelocTypeARM64 = 0
	ARM64_RELOC_SUBTRACTOR          RelocTypeARM64 = 1
	ARM64_RELOC_BRANCH26            RelocTypeARM64 = 2
	ARM64_RELOC_PAGE21              RelocTypeARM64 = 3
	ARM64_RELOC_PAGEOFF12           RelocTypeARM64 = 4
	ARM64_RELOC_GOT_LOAD_PAGE21     RelocTypeARM64 = 5
	ARM64_RELOC_GOT_LOAD_PAGEOFF12  RelocTypeARM64 = 6
	ARM64_RELOC_POINTER_TO_GOT      RelocTypeARM64 = 7
	ARM64_RELOC_TLVP_LOAD_PAGE21    RelocTypeARM64 = 8
	ARM64_RELOC_TLVP_LOAD_PAGEOFF12 RelocTypeARM64 = 9
	ARM64_RELOC_ADDEND              RelocTypeARM64 = 10
)

func (RelocTypeARM64) GoString

func (r RelocTypeARM64) GoString() string

func (RelocTypeARM64) String

func (i RelocTypeARM64) String() string

type RelocTypeGeneric

type RelocTypeGeneric int
const (
	GENERIC_RELOC_VANILLA        RelocTypeGeneric = 0
	GENERIC_RELOC_PAIR           RelocTypeGeneric = 1
	GENERIC_RELOC_SECTDIFF       RelocTypeGeneric = 2
	GENERIC_RELOC_PB_LA_PTR      RelocTypeGeneric = 3
	GENERIC_RELOC_LOCAL_SECTDIFF RelocTypeGeneric = 4
	GENERIC_RELOC_TLV            RelocTypeGeneric = 5
)

func (RelocTypeGeneric) GoString

func (r RelocTypeGeneric) GoString() string

func (RelocTypeGeneric) String

func (i RelocTypeGeneric) String() string

type RelocTypeX86_64

type RelocTypeX86_64 int
const (
	X86_64_RELOC_UNSIGNED   RelocTypeX86_64 = 0
	X86_64_RELOC_SIGNED     RelocTypeX86_64 = 1
	X86_64_RELOC_BRANCH     RelocTypeX86_64 = 2
	X86_64_RELOC_GOT_LOAD   RelocTypeX86_64 = 3
	X86_64_RELOC_GOT        RelocTypeX86_64 = 4
	X86_64_RELOC_SUBTRACTOR RelocTypeX86_64 = 5
	X86_64_RELOC_SIGNED_1   RelocTypeX86_64 = 6
	X86_64_RELOC_SIGNED_2   RelocTypeX86_64 = 7
	X86_64_RELOC_SIGNED_4   RelocTypeX86_64 = 8
	X86_64_RELOC_TLV        RelocTypeX86_64 = 9
)

func (RelocTypeX86_64) GoString

func (r RelocTypeX86_64) GoString() string

func (RelocTypeX86_64) String

func (i RelocTypeX86_64) String() string

type Routines64Cmd

type Routines64Cmd struct {
	LoadCmd     // LC_ROUTINES_64
	Len         uint32
	InitAddress uint64
	InitModule  uint64
	Reserved1   uint64
	Reserved2   uint64
	Reserved3   uint64
	Reserved4   uint64
	Reserved5   uint64
	Reserved6   uint64
}

A Routines64Cmd is a Mach-O 64-bit image routines command.

type RoutinesCmd

type RoutinesCmd struct {
	LoadCmd     // LC_ROUTINES
	Len         uint32
	InitAddress uint32
	InitModule  uint32
	Reserved1   uint32
	Reserved2   uint32
	Reserved3   uint32
	Reserved4   uint32
	Reserved5   uint32
	Reserved6   uint32
}

A RoutinesCmd is a Mach-O image routines command.

type RpathCmd

type RpathCmd struct {
	LoadCmd // LC_RPATH
	Len     uint32
	Path    uint32
}

A RpathCmd is a Mach-O rpath command.

type Section32

type Section32 struct {
	Name     [16]byte
	Seg      [16]byte
	Addr     uint32
	Size     uint32
	Offset   uint32
	Align    uint32
	Reloff   uint32
	Nreloc   uint32
	Flags    SectionFlag
	Reserve1 uint32
	Reserve2 uint32
}

A Section32 is a 32-bit Mach-O section header.

type Section64

type Section64 struct {
	Name     [16]byte
	Seg      [16]byte
	Addr     uint64
	Size     uint64
	Offset   uint32
	Align    uint32
	Reloff   uint32
	Nreloc   uint32
	Flags    SectionFlag
	Reserve1 uint32
	Reserve2 uint32
	Reserve3 uint32
}

A Section64 is a 64-bit Mach-O section header.

type SectionFlag

type SectionFlag uint32
const (
	SectionType       SectionFlag = 0x000000ff /* 256 section types */
	SectionAttributes SectionFlag = 0xffffff00 /*  24 section attributes */
)
const (
	/* Constants for the type of a section */
	Regular         SectionFlag = 0x0 /* regular section */
	Zerofill        SectionFlag = 0x1 /* zero fill on demand section */
	CstringLiterals SectionFlag = 0x2 /* section with only literal C strings*/
	ByteLiterals4   SectionFlag = 0x3 /* section with only 4 byte literals */
	ByteLiterals8   SectionFlag = 0x4 /* section with only 8 byte literals */
	LiteralPointers SectionFlag = 0x5 /* section with only pointers to literals */
	/*
	 * For the two types of symbol pointers sections and the symbol stubs section
	 * they have indirect symbol table entries.  For each of the entries in the
	 * section the indirect symbol table entries, in corresponding order in the
	 * indirect symbol table, start at the index stored in the reserved1 field
	 * of the section structure.  Since the indirect symbol table entries
	 * correspond to the entries in the section the number of indirect symbol table
	 * entries is inferred from the size of the section divided by the size of the
	 * entries in the section.  For symbol pointers sections the size of the entries
	 * in the section is 4 bytes and for symbol stubs sections the byte size of the
	 * stubs is stored in the reserved2 field of the section structure.
	 */
	NonLazySymbolPointers   SectionFlag = 0x6  /* section with only non-lazy symbol pointers */
	LazySymbolPointers      SectionFlag = 0x7  /* section with only lazy symbol pointers */
	SymbolStubs             SectionFlag = 0x8  /* section with only symbol stubs, byte size of stub in the reserved2 field */
	ModInitFuncPointers     SectionFlag = 0x9  /* section with only function pointers for initialization*/
	ModTermFuncPointers     SectionFlag = 0xa  /* section with only function pointers for termination */
	Coalesced               SectionFlag = 0xb  /* section contains symbols that are to be coalesced */
	GbZerofill              SectionFlag = 0xc  /* zero fill on demand section (that can be larger than 4 gigabytes) */
	Interposing             SectionFlag = 0xd  /* section with only pairs of function pointers for interposing */
	ByteLiterals16          SectionFlag = 0xe  /* section with only 16 byte literals */
	DtraceDof               SectionFlag = 0xf  /* section contains DTrace Object Format */
	LazyDylibSymbolPointers SectionFlag = 0x10 /* section with only lazy symbol pointers to lazy loaded dylibs */
	/*
	 * Section types to support thread local variables
	 */
	ThreadLocalRegular              SectionFlag = 0x11 /* template of initial values for TLVs */
	ThreadLocalZerofill             SectionFlag = 0x12 /* template of initial values for TLVs */
	ThreadLocalVariables            SectionFlag = 0x13 /* TLV descriptors */
	ThreadLocalVariablePointers     SectionFlag = 0x14 /* pointers to TLV descriptors */
	ThreadLocalInitFunctionPointers SectionFlag = 0x15 /* functions to call to initialize TLV values */
	InitFuncOffsets                 SectionFlag = 0x16 /* 32-bit offsets to initializers */
)

* The flags field of a section structure is separated into two parts a section * type and section attributes. The section types are mutually exclusive (it * can only have one type) but the section attributes are not (it may have more * than one attribute).

const (
	/*
	 * Constants for the section attributes part of the flags field of a section
	 * structure.
	 */
	SECTION_ATTRIBUTES_USR SectionFlag = 0xff000000 /* User setable attributes */
	SECTION_ATTRIBUTES_SYS SectionFlag = 0x00ffff00 /* system setable attributes */

	PURE_INSTRUCTIONS   SectionFlag = 0x80000000 /* section contains only true machine instructions */
	NO_TOC              SectionFlag = 0x40000000 /* section contains coalesced symbols that are not to be in a ranlib table of contents */
	STRIP_STATIC_SYMS   SectionFlag = 0x20000000 /* ok to strip static symbols in this section in files with the MH_DYLDLINK flag */
	NoDeadStrip         SectionFlag = 0x10000000 /* no dead stripping */
	LIVE_SUPPORT        SectionFlag = 0x08000000 /* blocks are live if they reference live blocks */
	SELF_MODIFYING_CODE SectionFlag = 0x04000000 /* Used with i386 code stubs written on by dyld */
	/*
	 * If a segment contains any sections marked with DEBUG then all
	 * sections in that segment must have this attribute.  No section other than
	 * a section marked with this attribute may reference the contents of this
	 * section.  A section with this attribute may contain no symbols and must have
	 * a section type S_REGULAR.  The static linker will not copy section contents
	 * from sections with this attribute into its output file.  These sections
	 * generally contain DWARF debugging info.
	 */
	DEBUG             SectionFlag = 0x02000000 /* a debug section */
	SOME_INSTRUCTIONS SectionFlag = 0x00000400 /* section contains some machine instructions */
	EXT_RELOC         SectionFlag = 0x00000200 /* section has external relocation entries */
	LOC_RELOC         SectionFlag = 0x00000100 /* section has local relocation entries */
)

func (SectionFlag) AttributesList

func (f SectionFlag) AttributesList() []string

func (SectionFlag) AttributesString

func (f SectionFlag) AttributesString() string

func (SectionFlag) GetAttributes

func (t SectionFlag) GetAttributes() SectionFlag

func (SectionFlag) Is16ByteLiterals

func (t SectionFlag) Is16ByteLiterals() bool

func (SectionFlag) Is4ByteLiterals

func (t SectionFlag) Is4ByteLiterals() bool

func (SectionFlag) Is8ByteLiterals

func (t SectionFlag) Is8ByteLiterals() bool

func (SectionFlag) IsCoalesced

func (t SectionFlag) IsCoalesced() bool

func (SectionFlag) IsCstringLiterals

func (t SectionFlag) IsCstringLiterals() bool

func (SectionFlag) IsDebug

func (t SectionFlag) IsDebug() bool

func (SectionFlag) IsDtraceDof

func (t SectionFlag) IsDtraceDof() bool

func (SectionFlag) IsExtReloc

func (t SectionFlag) IsExtReloc() bool

func (SectionFlag) IsGbZerofill

func (t SectionFlag) IsGbZerofill() bool

func (SectionFlag) IsInitFuncOffsets

func (t SectionFlag) IsInitFuncOffsets() bool

func (SectionFlag) IsInterposing

func (t SectionFlag) IsInterposing() bool

func (SectionFlag) IsLazyDylibSymbolPointers

func (t SectionFlag) IsLazyDylibSymbolPointers() bool

func (SectionFlag) IsLazySymbolPointers

func (t SectionFlag) IsLazySymbolPointers() bool

func (SectionFlag) IsLiteralPointers

func (t SectionFlag) IsLiteralPointers() bool

func (SectionFlag) IsLiveSupport

func (t SectionFlag) IsLiveSupport() bool

func (SectionFlag) IsLocReloc

func (t SectionFlag) IsLocReloc() bool

func (SectionFlag) IsModInitFuncPointers

func (t SectionFlag) IsModInitFuncPointers() bool

func (SectionFlag) IsModTermFuncPointers

func (t SectionFlag) IsModTermFuncPointers() bool

func (SectionFlag) IsNoDeadStrip

func (t SectionFlag) IsNoDeadStrip() bool

func (SectionFlag) IsNoToc

func (t SectionFlag) IsNoToc() bool

func (SectionFlag) IsNonLazySymbolPointers

func (t SectionFlag) IsNonLazySymbolPointers() bool

func (SectionFlag) IsPureInstructions

func (t SectionFlag) IsPureInstructions() bool

func (SectionFlag) IsRegular

func (t SectionFlag) IsRegular() bool

func (SectionFlag) IsSelfModifyingCode

func (t SectionFlag) IsSelfModifyingCode() bool

func (SectionFlag) IsSomeInstructions

func (t SectionFlag) IsSomeInstructions() bool

func (SectionFlag) IsStripStaticSyms

func (t SectionFlag) IsStripStaticSyms() bool

func (SectionFlag) IsSymbolStubs

func (t SectionFlag) IsSymbolStubs() bool

func (SectionFlag) IsThreadLocalInitFunctionPointers

func (t SectionFlag) IsThreadLocalInitFunctionPointers() bool

func (SectionFlag) IsThreadLocalRegular

func (t SectionFlag) IsThreadLocalRegular() bool

func (SectionFlag) IsThreadLocalVariablePointers

func (t SectionFlag) IsThreadLocalVariablePointers() bool

func (SectionFlag) IsThreadLocalVariables

func (t SectionFlag) IsThreadLocalVariables() bool

func (SectionFlag) IsThreadLocalZerofill

func (t SectionFlag) IsThreadLocalZerofill() bool

func (SectionFlag) IsZerofill

func (t SectionFlag) IsZerofill() bool

func (SectionFlag) List

func (f SectionFlag) List() []string

func (SectionFlag) String

func (f SectionFlag) String() string

type SegFlag

type SegFlag uint32
const (
	HighVM SegFlag = 0x1 /* the file contents for this segment is for
	   the high part of the VM space, the low part
	   is zero filled (for stacks in core files) */
	FvmLib SegFlag = 0x2 /* this segment is the VM that is allocated by
	   a fixed VM library, for overlap checking in
	   the link editor */
	NoReLoc SegFlag = 0x4 /* this segment has nothing that was relocated
	   in it and nothing relocated to it, that is
	   it maybe safely replaced without relocation*/
	ProtectedVersion1 SegFlag = 0x8 /* This segment is protected.  If the
	   segment starts at file offset 0, the
	   first page of the segment is not
	   protected.  All other pages of the
	   segment are protected. */
	ReadOnly SegFlag = 0x10 /* This segment is made read-only after fixups */
)

Constants for the flags field of the segment_command

type Segment32

type Segment32 struct {
	LoadCmd              /* LC_SEGMENT */
	Len     uint32       /* includes sizeof section structs */
	Name    [16]byte     /* segment name */
	Addr    uint32       /* memory address of this segment */
	Memsz   uint32       /* memory size of this segment */
	Offset  uint32       /* file offset of this segment */
	Filesz  uint32       /* amount to map from the file */
	Maxprot VmProtection /* maximum VM protection */
	Prot    VmProtection /* initial VM protection */
	Nsect   uint32       /* number of sections in segment */
	Flag    SegFlag      /* flags */
}

A Segment32 is a 32-bit Mach-O segment load command.

type Segment64

type Segment64 struct {
	LoadCmd              /* LC_SEGMENT_64 */
	Len     uint32       /* includes sizeof section_64 structs */
	Name    [16]byte     /* segment name */
	Addr    uint64       /* memory address of this segment */
	Memsz   uint64       /* memory size of this segment */
	Offset  uint64       /* file offset of this segment */
	Filesz  uint64       /* amount to map from the file */
	Maxprot VmProtection /* maximum VM protection */
	Prot    VmProtection /* initial VM protection */
	Nsect   uint32       /* number of sections in segment */
	Flag    SegFlag      /* flags */
}

A Segment64 is a 64-bit Mach-O segment load command.

type SegmentSplitInfoCmd

type SegmentSplitInfoCmd LinkEditDataCmd // LC_SEGMENT_SPLIT_INFO

A SegmentSplitInfoCmd is a Mach-O code info to split segments command.

type SourceVersionCmd

type SourceVersionCmd struct {
	LoadCmd // LC_SOURCE_VERSION
	Len     uint32
	Version SrcVersion // A.B.C.D.E packed as a24.b10.c10.d10.e10
}

A SourceVersionCmd is a Mach-O source version command.

type SrcVersion

type SrcVersion uint64

func (SrcVersion) String

func (sv SrcVersion) String() string

type SubClientCmd

type SubClientCmd struct {
	LoadCmd // LC_SUB_CLIENT
	Len     uint32
	Client  uint32
}

A SubClientCmd is a Mach-O dynamic sub client command.

type SubFrameworkCmd

type SubFrameworkCmd struct {
	LoadCmd   // LC_SUB_FRAMEWORK
	Len       uint32
	Framework uint32
}

A SubFrameworkCmd is a Mach-O dynamic sub_framework_command.

type SubLibraryCmd

type SubLibraryCmd struct {
	LoadCmd // LC_SUB_LIBRARY
	Len     uint32
	Library uint32
}

A SubLibraryCmd is a Mach-O dynamic sub_library_command.

type SubUmbrellaCmd

type SubUmbrellaCmd struct {
	LoadCmd  // LC_SUB_UMBRELLA
	Len      uint32
	Umbrella uint32
}

A SubUmbrellaCmd is a Mach-O dynamic sub_umbrella_command.

type SwiftClassMetadata added in v1.0.12

type SwiftClassMetadata struct {
	ObjcClassType
	SwiftClassFlags uint32
}

type SwiftClassMetadata64 added in v1.0.12

type SwiftClassMetadata64 struct {
	ObjcClass64Type
	SwiftClassFlags uint64
}

type SymsegCommand

type SymsegCommand struct {
	LoadCmd        /* LC_SYMSEG */
	Len     uint32 /* sizeof(struct symseg_command) */
	Offset  uint32 /* symbol segment offset */
	Size    uint32 /* symbol segment size in bytes */
}

* The symseg_command contains the offset and size of the GNU style * symbol table information as described in the header file <symseg.h>. * The symbol roots of the symbol segments must also be aligned properly * in the file. So the requirement of keeping the offsets aligned to a * multiple of a 4 bytes translates to the length field of the symbol * roots also being a multiple of a long. Also the padding must again be * zeroed. (THIS IS OBSOLETE and no longer supported).

type SymtabCmd

type SymtabCmd struct {
	LoadCmd // LC_SYMTAB
	Len     uint32
	Symoff  uint32
	Nsyms   uint32
	Stroff  uint32
	Strsize uint32
}

A SymtabCmd is a Mach-O symbol table command.

type Thread

type Thread struct {
	LoadCmd // LC_THREAD
	Len     uint32
	Type    uint32
	Data    []uint32
}

A Thread is a Mach-O thread state command.

type Tool

type Tool uint32

func (Tool) String

func (i Tool) String() string

type TwolevelHintsCmd

type TwolevelHintsCmd struct {
	LoadCmd  // LC_TWOLEVEL_HINTS
	Len      uint32
	Offset   uint32
	NumHints uint32
}

A TwolevelHintsCmd is a Mach-O two-level namespace lookup hints command.

type UUID

type UUID [16]byte

UUID is a macho uuid object

func (UUID) String

func (u UUID) String() string

type UUIDCmd

type UUIDCmd struct {
	LoadCmd // LC_UUID
	Len     uint32
	UUID    UUID
}

A UUIDCmd is a Mach-O uuid load command contains a single 128-bit unique random number that identifies an object produced by the static link editor.

type UnixThreadCmd

type UnixThreadCmd struct {
	LoadCmd // LC_UNIXTHREAD
	Len     uint32
	Flavor  uint32
	Count   uint32
}

A UnixThreadCmd is a Mach-O unix thread command.

type UpwardDylibCmd

type UpwardDylibCmd DylibCmd // LC_LOAD_UPWARD_DYLIB

A UpwardDylibCmd is a Mach-O load upward dylibcommand.

type Version

type Version uint32

func (Version) String

func (v Version) String() string

type VersionMinCmd

type VersionMinCmd struct {
	LoadCmd
	Len     uint32
	Version Version
	Sdk     Version
}

A VersionMinCmd is a Mach-O version min command.

type VersionMinIPhoneOSCmd

type VersionMinIPhoneOSCmd VersionMinCmd // LC_VERSION_MIN_IPHONEOS

A VersionMinIPhoneOSCmd is a Mach-O build for iPhoneOS min OS version command.

type VersionMinMacOSCmd

type VersionMinMacOSCmd VersionMinCmd // LC_VERSION_MIN_MACOSX

A VersionMinMacOSCmd is a Mach-O build for macOS min OS version command.

type VersionMinTvOSCmd

type VersionMinTvOSCmd VersionMinCmd // LC_VERSION_MIN_TVOS

A VersionMinTvOSCmd is a Mach-O build for tvOS min OS version command.

type VersionMinWatchOSCmd

type VersionMinWatchOSCmd VersionMinCmd // LC_VERSION_MIN_WATCHOS

A VersionMinWatchOSCmd is a Mach-O build for watchOS min OS version command.

type VmProtection

type VmProtection int32

func (VmProtection) Execute

func (v VmProtection) Execute() bool

func (VmProtection) Read

func (v VmProtection) Read() bool

func (VmProtection) String

func (v VmProtection) String() string

func (VmProtection) Write

func (v VmProtection) Write() bool

type WeakDylibCmd

type WeakDylibCmd DylibCmd // LC_LOAD_WEAK_DYLIB

A WeakDylibCmd is a Mach-O load a dynamically linked shared library that is allowed to be missing (all symbols are weak imported) command.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL