Documentation ¶
Index ¶
- Constants
- func ExtractBits(x uint64, start, nbits int32) uint64
- func MaskLSB64(x uint64, nbits uint8) uint64
- func PutAtMost16Bytes(b []byte, n string)
- func RoundUp(x, align uint64) uint64
- func StringName(i uint32, names []IntName, goSyntax bool) string
- func StringName64(i uint64, names []Int64Name, goSyntax bool) string
- type BuildToolVersion
- type BuildVersionCmd
- type CPU
- type CPUSubtype
- type CodeSignatureCmd
- type DataInCodeCmd
- type DataInCodeEntry
- type DiceKind
- type DyldChainedFixupsCmd
- type DyldEnvironmentCmd
- type DyldExportsTrieCmd
- type DyldInfoCmd
- type DyldInfoOnlyCmd
- type DylibCmd
- type DylibCodeSignDrsCmd
- type DylibID
- type DylinkerCmd
- type DylinkerIDCmd
- type DysymtabCmd
- type EncryptionInfo64Cmd
- type EncryptionInfoCmd
- type EncryptionSystem
- type EntryPointCmd
- type ExportFlag
- type FileHeader
- type FilePointer
- type FilesetEntryCmd
- type FunctionStartsCmd
- type FvmFileCmd
- type HeaderFileType
- type HeaderFlag
- func (f HeaderFlag) AllModsBound() bool
- func (f HeaderFlag) AllowStackExecution() bool
- func (f HeaderFlag) AppExtensionSafe() bool
- func (f HeaderFlag) BindAtLoad() bool
- func (f HeaderFlag) BindsToWeak() bool
- func (f HeaderFlag) Canonical() bool
- func (f HeaderFlag) DeadStrippableDylib() bool
- func (f HeaderFlag) DyldLink() bool
- func (f HeaderFlag) DylibInCache() bool
- func (f HeaderFlag) Flags() string
- func (f HeaderFlag) ForceFlat() bool
- func (f HeaderFlag) HasTLVDescriptors() bool
- func (f HeaderFlag) IncrLink() bool
- func (f HeaderFlag) LazyInit() bool
- func (f HeaderFlag) List() []string
- func (f HeaderFlag) NlistOutofsyncWithDyldinfo() bool
- func (f HeaderFlag) NoFixPrebinding() bool
- func (f HeaderFlag) NoHeapExecution() bool
- func (f HeaderFlag) NoMultiDefs() bool
- func (f HeaderFlag) NoReexportedDylibs() bool
- func (f HeaderFlag) NoUndefs() bool
- func (f HeaderFlag) PIE() bool
- func (f HeaderFlag) Prebindable() bool
- func (f HeaderFlag) Prebound() bool
- func (f HeaderFlag) RootSafe() bool
- func (f *HeaderFlag) Set(flag HeaderFlag, set bool)
- func (f HeaderFlag) SetuidSafe() bool
- func (f HeaderFlag) SimSupport() bool
- func (f HeaderFlag) SplitSegs() bool
- func (i HeaderFlag) String() string
- func (f HeaderFlag) SubsectionsViaSymbols() bool
- func (f HeaderFlag) TwoLevel() bool
- func (f HeaderFlag) WeakDefines() bool
- type IDFvmLibCmd
- type IdentCmd
- type Int64Name
- type IntName
- type LazyLoadDylibCmd
- type LinkEditDataCmd
- type LinkerOptimizationHintCmd
- type LinkerOptionCmd
- type LoadCmd
- type LoadFvmLibCmd
- type Magic
- type NDescType
- func (d NDescType) GetCommAlign() NDescType
- func (d NDescType) GetLibraryOrdinal() NDescType
- func (d NDescType) IsDefined() bool
- func (d NDescType) IsPrivateDefined() bool
- func (d NDescType) IsPrivateUndefinedLazy() bool
- func (d NDescType) IsPrivateUndefinedNonLazy() bool
- func (d NDescType) IsUndefinedLazy() bool
- func (d NDescType) IsUndefinedNonLazy() bool
- func (t NDescType) String() string
- type NType
- func (t NType) IsAbsoluteSym() bool
- func (t NType) IsDebugSym() bool
- func (t NType) IsDefinedInSection() bool
- func (t NType) IsExternalSym() bool
- func (t NType) IsIndirectSym() bool
- func (t NType) IsPreboundUndefinedSym() bool
- func (t NType) IsPrivateExternalSym() bool
- func (t NType) IsUndefinedSym() bool
- func (t NType) String(secName string) string
- type Nlist32
- type Nlist64
- type NoteCmd
- type Platform
- type PrePageCmd
- type PrebindCksumCmd
- type PreboundDylibCmd
- type ReExportDylibCmd
- type RelocTypeARM
- type RelocTypeARM64
- type RelocTypeGeneric
- type RelocTypeX86_64
- type Routines64Cmd
- type RoutinesCmd
- type RpathCmd
- type Section32
- type Section64
- type SectionFlag
- func (f SectionFlag) AttributesList() []string
- func (f SectionFlag) AttributesString() string
- func (t SectionFlag) GetAttributes() SectionFlag
- func (t SectionFlag) Is16ByteLiterals() bool
- func (t SectionFlag) Is4ByteLiterals() bool
- func (t SectionFlag) Is8ByteLiterals() bool
- func (t SectionFlag) IsCoalesced() bool
- func (t SectionFlag) IsCstringLiterals() bool
- func (t SectionFlag) IsDebug() bool
- func (t SectionFlag) IsDtraceDof() bool
- func (t SectionFlag) IsExtReloc() bool
- func (t SectionFlag) IsGbZerofill() bool
- func (t SectionFlag) IsInitFuncOffsets() bool
- func (t SectionFlag) IsInterposing() bool
- func (t SectionFlag) IsLazyDylibSymbolPointers() bool
- func (t SectionFlag) IsLazySymbolPointers() bool
- func (t SectionFlag) IsLiteralPointers() bool
- func (t SectionFlag) IsLiveSupport() bool
- func (t SectionFlag) IsLocReloc() bool
- func (t SectionFlag) IsModInitFuncPointers() bool
- func (t SectionFlag) IsModTermFuncPointers() bool
- func (t SectionFlag) IsNoDeadStrip() bool
- func (t SectionFlag) IsNoToc() bool
- func (t SectionFlag) IsNonLazySymbolPointers() bool
- func (t SectionFlag) IsPureInstructions() bool
- func (t SectionFlag) IsRegular() bool
- func (t SectionFlag) IsSelfModifyingCode() bool
- func (t SectionFlag) IsSomeInstructions() bool
- func (t SectionFlag) IsStripStaticSyms() bool
- func (t SectionFlag) IsSymbolStubs() bool
- func (t SectionFlag) IsThreadLocalInitFunctionPointers() bool
- func (t SectionFlag) IsThreadLocalRegular() bool
- func (t SectionFlag) IsThreadLocalVariablePointers() bool
- func (t SectionFlag) IsThreadLocalVariables() bool
- func (t SectionFlag) IsThreadLocalZerofill() bool
- func (t SectionFlag) IsZerofill() bool
- func (f SectionFlag) List() []string
- func (f SectionFlag) String() string
- type SegFlag
- type Segment32
- type Segment64
- type SegmentSplitInfoCmd
- type SourceVersionCmd
- type SrcVersion
- type SubClientCmd
- type SubFrameworkCmd
- type SubLibraryCmd
- type SubUmbrellaCmd
- type SymsegCommand
- type SymtabCmd
- type Thread
- type Tool
- type TwolevelHintsCmd
- type UUID
- type UUIDCmd
- type UnixThreadCmd
- type UpwardDylibCmd
- type Version
- type VersionMinCmd
- type VersionMinIPhoneOSCmd
- type VersionMinMacOSCmd
- type VersionMinTvOSCmd
- type VersionMinWatchOSCmd
- type VmProtection
- type WeakDylibCmd
Constants ¶
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.
const ( /* The following are used to encode rebasing information */ REBASE_TYPE_POINTER = 1 REBASE_TYPE_TEXT_ABSOLUTE32 = 2 REBASE_TYPE_TEXT_PCREL32 = 3 REBASE_OPCODE_MASK = 0xF0 REBASE_IMMEDIATE_MASK = 0x0F REBASE_OPCODE_DONE = 0x00 REBASE_OPCODE_SET_TYPE_IMM = 0x10 REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB = 0x20 REBASE_OPCODE_ADD_ADDR_ULEB = 0x30 REBASE_OPCODE_ADD_ADDR_IMM_SCALED = 0x40 REBASE_OPCODE_DO_REBASE_IMM_TIMES = 0x50 REBASE_OPCODE_DO_REBASE_ULEB_TIMES = 0x60 REBASE_OPCODE_DO_REBASE_ADD_ADDR_ULEB = 0x70 REBASE_OPCODE_DO_REBASE_ULEB_TIMES_SKIPPING_ULEB = 0x80 )
const ( /* The following are used to encode binding information */ BIND_TYPE_POINTER = 1 BIND_TYPE_TEXT_ABSOLUTE32 = 2 BIND_TYPE_TEXT_PCREL32 = 3 BIND_SPECIAL_DYLIB_SELF = 0 BIND_SPECIAL_DYLIB_MAIN_EXECUTABLE = -1 BIND_SPECIAL_DYLIB_FLAT_LOOKUP = -2 BIND_SPECIAL_DYLIB_WEAK_LOOKUP = -3 BIND_SYMBOL_FLAGS_WEAK_IMPORT = 0x1 BIND_SYMBOL_FLAGS_NON_WEAK_DEFINITION = 0x8 BIND_OPCODE_MASK = 0xF0 BIND_IMMEDIATE_MASK = 0x0F BIND_OPCODE_DONE = 0x00 BIND_OPCODE_SET_DYLIB_ORDINAL_IMM = 0x10 BIND_OPCODE_SET_DYLIB_ORDINAL_ULEB = 0x20 BIND_OPCODE_SET_DYLIB_SPECIAL_IMM = 0x30 BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM = 0x40 BIND_OPCODE_SET_TYPE_IMM = 0x50 BIND_OPCODE_SET_ADDEND_SLEB = 0x60 BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB = 0x70 BIND_OPCODE_ADD_ADDR_ULEB = 0x80 BIND_OPCODE_DO_BIND = 0x90 BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB = 0xA0 BIND_OPCODE_DO_BIND_ADD_ADDR_IMM_SCALED = 0xB0 BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB = 0xC0 BIND_OPCODE_THREADED = 0xD0 BIND_SUBOPCODE_THREADED_SET_BIND_ORDINAL_TABLE_SIZE_ULEB = 0x00 BIND_SUBOPCODE_THREADED_APPLY = 0x01 )
const ( DYLD_CACHE_ADJ_V2_FORMAT = 0x7F DYLD_CACHE_ADJ_V2_POINTER_32 = 0x01 DYLD_CACHE_ADJ_V2_POINTER_64 = 0x02 DYLD_CACHE_ADJ_V2_DELTA_32 = 0x03 DYLD_CACHE_ADJ_V2_DELTA_64 = 0x04 DYLD_CACHE_ADJ_V2_ARM64_ADRP = 0x05 DYLD_CACHE_ADJ_V2_ARM64_OFF12 = 0x06 DYLD_CACHE_ADJ_V2_ARM64_BR26 = 0x07 DYLD_CACHE_ADJ_V2_ARM_MOVW_MOVT = 0x08 DYLD_CACHE_ADJ_V2_ARM_BR24 = 0x09 DYLD_CACHE_ADJ_V2_THUMB_MOVW_MOVT = 0x0A DYLD_CACHE_ADJ_V2_THUMB_BR22 = 0x0B DYLD_CACHE_ADJ_V2_IMAGE_OFF_32 = 0x0C DYLD_CACHE_ADJ_V2_THREADED_POINTER_64 = 0x0D )
const ( FileHeaderSize32 = 7 * 4 FileHeaderSize64 = 8 * 4 )
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.
Variables ¶
This section is empty.
Functions ¶
func ExtractBits ¶ added in v1.0.10
func PutAtMost16Bytes ¶ added in v1.0.16
****** HELPERS *******
Types ¶
type BuildToolVersion ¶
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 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 CodeSignatureCmd ¶
type CodeSignatureCmd LinkEditDataCmd // LC_CODE_SIGNATURE
A CodeSignatureCmd is a Mach-O code signature command.
type DataInCodeCmd ¶
type DataInCodeCmd LinkEditDataCmd // LC_DATA_IN_CODE
A DataInCodeCmd is a Mach-O data in code command.
type DataInCodeEntry ¶
type DyldChainedFixupsCmd ¶
type DyldChainedFixupsCmd LinkEditDataCmd // LC_DYLD_CHAINED_FIXUPS
A DyldChainedFixupsCmd is used with linkedit_data_command command.
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 EncryptionSystem // 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 ExportFlag ¶ added in v1.0.26
type ExportFlag int
const ( /* * The following are used on the flags byte of a terminal node * in the export information. */ EXPORT_SYMBOL_FLAGS_KIND_MASK ExportFlag = 0x03 EXPORT_SYMBOL_FLAGS_KIND_REGULAR ExportFlag = 0x00 EXPORT_SYMBOL_FLAGS_KIND_THREAD_LOCAL ExportFlag = 0x01 EXPORT_SYMBOL_FLAGS_KIND_ABSOLUTE ExportFlag = 0x02 EXPORT_SYMBOL_FLAGS_WEAK_DEFINITION ExportFlag = 0x04 EXPORT_SYMBOL_FLAGS_REEXPORT ExportFlag = 0x08 EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER ExportFlag = 0x10 )
func (ExportFlag) Absolute ¶ added in v1.0.26
func (f ExportFlag) Absolute() bool
func (ExportFlag) ReExport ¶ added in v1.0.26
func (f ExportFlag) ReExport() bool
func (ExportFlag) Regular ¶ added in v1.0.26
func (f ExportFlag) Regular() bool
func (ExportFlag) String ¶ added in v1.0.26
func (f ExportFlag) String() string
func (ExportFlag) StubAndResolver ¶ added in v1.0.26
func (f ExportFlag) StubAndResolver() bool
func (ExportFlag) ThreadLocal ¶ added in v1.0.26
func (f ExportFlag) ThreadLocal() bool
func (ExportFlag) WeakDefinition ¶ added in v1.0.26
func (f ExportFlag) WeakDefinition() bool
type FileHeader ¶
type FileHeader struct { Magic Magic CPU CPU SubCPU CPUSubtype Type HeaderFileType NCommands uint32 SizeCommands uint32 Flags HeaderFlag Reserved uint32 }
A FileHeader represents a Mach-O file header.
func (FileHeader) String ¶
func (h FileHeader) String() string
type FilePointer ¶ added in v1.0.12
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 HeaderFileType ¶ added in v1.0.22
type HeaderFileType uint32
A HeaderFileType is the Mach-O file type, e.g. an object file, executable, or dynamic library.
const ( Obj HeaderFileType = 1 Exec HeaderFileType = 2 FVMLib HeaderFileType = 3 Core HeaderFileType = 4 Preload HeaderFileType = 5 /* preloaded executable file */ Dylib HeaderFileType = 6 /* dynamically bound shared library */ Dylinker HeaderFileType = 7 /* dynamic link editor */ Bundle HeaderFileType = 8 DylibStub HeaderFileType = 0x9 /* shared library stub for static */ Dsym HeaderFileType = 0xa /* companion file with only debug */ KextBundle HeaderFileType = 0xb /* x86_64 kexts */ FileSet HeaderFileType = 0xc /* a file composed of other Mach-Os to be run in the same userspace sharing a single linkedit. */ )
func (HeaderFileType) String ¶ added in v1.0.22
func (i HeaderFileType) String() string
type HeaderFlag ¶
type HeaderFlag uint32
const ( None HeaderFlag = 0x0 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 (HeaderFlag) DyldLink ¶
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 (HeaderFlag) IncrLink ¶
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) 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) 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 IDFvmLibCmd ¶
type IDFvmLibCmd LoadFvmLibCmd // LC_IDFVMLIB
A IDFvmLibCmd is a Mach-O fixed VM shared library identification command.
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 ¶
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 */ )
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 NDescType ¶ added in v1.0.24
type NDescType uint16
const ( /* types of references */ REFERENCE_FLAG_UNDEFINED_NON_LAZY NDescType = 0 REFERENCE_FLAG_UNDEFINED_LAZY NDescType = 1 REFERENCE_FLAG_DEFINED NDescType = 2 REFERENCE_FLAG_PRIVATE_DEFINED NDescType = 3 REFERENCE_FLAG_PRIVATE_UNDEFINED_NON_LAZY NDescType = 4 REFERENCE_FLAG_PRIVATE_UNDEFINED_LAZY NDescType = 5 )
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 NDescType = 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 NDescType = 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 NDescType = 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 NDescType = 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 NDescType = 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 NDescType = 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 NDescType = 0x0100 /* * The N_ALT_ENTRY bit of the n_desc field indicates that the * symbol is pinned to the previous content. */ ALT_ENTRY NDescType = 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 NDescType = 0x0400 )
const REFERENCE_TYPE NDescType = 0x7
func (NDescType) GetCommAlign ¶ added in v1.0.24
func (NDescType) GetLibraryOrdinal ¶ added in v1.0.24
func (NDescType) IsPrivateDefined ¶ added in v1.0.24
func (NDescType) IsPrivateUndefinedLazy ¶ added in v1.0.24
func (NDescType) IsPrivateUndefinedNonLazy ¶ added in v1.0.24
func (NDescType) IsUndefinedLazy ¶ added in v1.0.24
func (NDescType) IsUndefinedNonLazy ¶ added in v1.0.24
type NType ¶ added in v1.0.24
type NType uint8
const ( N_STAB NType = 0xe0 /* if any of these bits set, a symbolic debugging entry */ N_PEXT NType = 0x10 /* private external symbol bit */ N_TYPE NType = 0x0e /* mask for the type bits */ N_EXT NType = 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 NType = 0x0 /* undefined, n_sect == NO_SECT */ N_ABS NType = 0x2 /* absolute, n_sect == NO_SECT */ N_SECT NType = 0xe /* defined in section number n_sect */ N_PBUD NType = 0xc /* prebound undefined (defined in a dylib) */ N_INDR NType = 0xa /* indirect */ )
* Values for N_TYPE bits of the n_type field.
func (NType) IsAbsoluteSym ¶ added in v1.0.24
func (NType) IsDebugSym ¶ added in v1.0.24
func (NType) IsDefinedInSection ¶ added in v1.0.24
func (NType) IsExternalSym ¶ added in v1.0.24
func (NType) IsIndirectSym ¶ added in v1.0.24
func (NType) IsPreboundUndefinedSym ¶ added in v1.0.24
func (NType) IsPrivateExternalSym ¶ added in v1.0.24
func (NType) IsUndefinedSym ¶ added in v1.0.24
type PrePageCmd ¶
type PrePageCmd interface{} // LC_PREPAGE
A PrePageCmd is a Mach-O prepage command (internal use) command.
type PrebindCksumCmd ¶
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 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 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 ¶
A SubClientCmd is a Mach-O dynamic sub client command.
type SubFrameworkCmd ¶
A SubFrameworkCmd is a Mach-O dynamic sub_framework_command.
type SubLibraryCmd ¶
A SubLibraryCmd is a Mach-O dynamic sub_library_command.
type SubUmbrellaCmd ¶
A SubUmbrellaCmd is a Mach-O dynamic sub_umbrella_command.
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 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 UUIDCmd ¶
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 ¶
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 VersionMinCmd ¶
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.