Documentation ¶
Index ¶
- Constants
- func ExtractBits(x uint64, start, nbits int32) uint64
- func IsASCII(s string) bool
- 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 ArmThreadFlavor
- type Bind
- type BindKind
- type Binds
- type BuildVersionCmd
- type BuildVersionTool
- type CPU
- type CPUSubtype
- type CodeSignatureCmd
- type CustomSectionReader
- func (s *CustomSectionReader) Read(p []byte) (n int, err error)
- func (s *CustomSectionReader) ReadAt(p []byte, off int64) (n int, err error)
- func (s *CustomSectionReader) ReadAtAddr(buf []byte, addr uint64) (int, error)
- func (s *CustomSectionReader) Seek(offset int64, whence int) (int64, error)
- func (s *CustomSectionReader) SeekToAddr(addr uint64) error
- func (s *CustomSectionReader) Size() int64
- type DataInCodeCmd
- type DataInCodeEntry
- type DiceKind
- type DyldChainedFixupsCmd
- type DyldEnvironmentCmd
- type DyldExportsTrieCmd
- type DyldInfoCmd
- type DyldInfoOnlyCmd
- type DylibCmd
- type DylibCodeSignDrsCmd
- type DylibModule
- type DylibModule64
- type DylibReference
- type DylibTableOfContents
- type DylibUseCmd
- type DylibUseFlags
- type DylinkerCmd
- type DysymtabCmd
- type EncryptionInfo64Cmd
- type EncryptionInfoCmd
- type EncryptionSystem
- type EntryPointCmd
- type ExportFlag
- func (f ExportFlag) Absolute() bool
- func (f ExportFlag) ReExport() bool
- func (f ExportFlag) Regular() bool
- func (f ExportFlag) StaticResolver() bool
- func (f ExportFlag) String() string
- func (f ExportFlag) StubAndResolver() bool
- func (f ExportFlag) ThreadLocal() bool
- func (f ExportFlag) WeakDefinition() bool
- type FileHeader
- type FilePointer
- type FilesetEntryCmd
- type Function
- 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) ImplicitPagezero() bool
- func (f HeaderFlag) IncrLink() bool
- func (f HeaderFlag) LazyInit() bool
- 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) None() 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 (f HeaderFlag) String() string
- func (f HeaderFlag) SubsectionsViaSymbols() bool
- func (f HeaderFlag) TwoLevel() bool
- func (f HeaderFlag) WeakDefines() bool
- type IDDylibCmd
- type IDDylinkerCmd
- type IDFvmLibCmd
- type IdentCmd
- type Int64Name
- type IntName
- type LazyLoadDylibCmd
- type LinkEditDataCmd
- type LinkerOptimizationHintCmd
- type LinkerOptionCmd
- type LoadCmd
- type LoadDylibCmd
- type LoadFvmLibCmd
- type LoadUpwardDylibCmd
- type LoadWeakDylibCmd
- type MachoReader
- type Magic
- type NDescType
- func (d NDescType) GetCommAlign() NDescType
- func (d NDescType) GetLibraryOrdinal() uint16
- func (d NDescType) IsAltEntry() bool
- func (d NDescType) IsArmThumbDefintion() bool
- func (d NDescType) IsColdFunc() bool
- func (d NDescType) IsDefined() bool
- func (d NDescType) IsDescDiscarded() bool
- func (d NDescType) IsNoDeadStrip() bool
- func (d NDescType) IsPrivateDefined() bool
- func (d NDescType) IsPrivateUndefinedLazy() bool
- func (d NDescType) IsPrivateUndefinedNonLazy() bool
- func (d NDescType) IsReferenceToWeak() bool
- func (d NDescType) IsReferencedDynamically() bool
- func (d NDescType) IsSymbolResolver() bool
- func (d NDescType) IsUndefinedLazy() bool
- func (d NDescType) IsUndefinedNonLazy() bool
- func (d NDescType) IsWeakDefintion() bool
- func (d NDescType) IsWeakDefintionOrReferenced() bool
- func (d NDescType) IsWeakReferenced() bool
- func (t NDescType) String() string
- type NType
- func (t NType) IsAbsoluteSym() bool
- func (t NType) IsAlternateEntry() bool
- func (t NType) IsAstFilePath() bool
- func (t NType) IsBeginCommon() bool
- func (t NType) IsBeginNsectSym() bool
- func (t NType) IsCompilerOLevel() bool
- func (t NType) IsCompilerParams() bool
- func (t NType) IsCompilerVersion() bool
- func (t NType) IsDebugSym() bool
- func (t NType) IsDefinedInSection() bool
- func (t NType) IsDeletedIncludeFile() bool
- func (t NType) IsEndCommon() bool
- func (t NType) IsEndCommonLocal() bool
- func (t NType) IsEndNsectSym() bool
- func (t NType) IsExternalSym() bool
- func (t NType) IsGccCompiled() bool
- func (t NType) IsGlobal() bool
- func (t NType) IsIncludeFileBegin() bool
- func (t NType) IsIncludeFileEnd() bool
- func (t NType) IsIncludedFile() bool
- func (t NType) IsIndirectSym() bool
- func (t NType) IsLcommSym() bool
- func (t NType) IsLeftBracket() bool
- func (t NType) IsLib() bool
- func (t NType) IsLocalSym() bool
- func (t NType) IsObjectFile() bool
- func (t NType) IsParameter() bool
- func (t NType) IsPascalSymbol() bool
- func (t NType) IsPreboundUndefinedSym() bool
- func (t NType) IsPrivateExternalSym() bool
- func (t NType) IsProcedure() bool
- func (t NType) IsProcedureName() bool
- func (t NType) IsRegisterSym() bool
- func (t NType) IsRightBracket() bool
- func (t NType) IsSecondStabEntry() bool
- func (t NType) IsSourceFile() bool
- func (t NType) IsSourceLine() bool
- func (t NType) IsStatic() bool
- func (t NType) IsStructure() bool
- func (t NType) IsUndefinedSym() bool
- func (t NType) String(secName string) string
- type Nlist
- type Nlist32
- type Nlist64
- type NoteAddrableBitsV3
- type NoteAddrableBitsV4
- type NoteAllImageInfos
- type NoteAllImageInfosImage
- type NoteAllImageInfosImageEntry
- type NoteAllImageInfosSegmentVmaddr
- type NoteCmd
- type Platform
- type PrePageCmd
- type PrebindCksumCmd
- type PreboundDylibCmd
- type ReExportDylibCmd
- type Rebase
- type Reloc
- type RelocInfo
- type RelocTypeARM
- type RelocTypeARM64
- type RelocTypeGeneric
- type RelocTypeX86_64
- type Routines64Cmd
- type RoutinesCmd
- type RpathCmd
- type Section
- func (s *Section) Copy() *Section
- func (s *Section) Data() ([]byte, error)
- func (s *Section) MarshalJSON() ([]byte, error)
- func (s *Section) Open() io.ReadSeeker
- func (s *Section) Put32(b []byte, o binary.ByteOrder) int
- func (s *Section) Put64(b []byte, o binary.ByteOrder) int
- func (s *Section) PutData(b []byte)
- func (s *Section) PutRelocs(b []byte, o binary.ByteOrder) int
- func (s *Section) PutUncompressedData(b []byte)
- func (s *Section) SetReaders(r io.ReaderAt, sr *io.SectionReader)
- func (s *Section) String() string
- func (s *Section) UncompressedSize() uint64
- func (s *Section) Write(buf *bytes.Buffer, o binary.ByteOrder) error
- type Section32
- type Section64
- type SectionFlag
- func (f SectionFlag) Attributes() string
- func (f SectionFlag) AttributesList() []string
- 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 SectionHeader
- type SegFlag
- type Segment32
- type Segment64
- type SegmentSplitInfoCmd
- type SepCacheSlideCmd
- type SepSymsegCmd
- type SepSymtabCmd
- type SepUnknown2Cmd
- type SepUnknown3Cmd
- type SourceVersionCmd
- type SplitInfoKind
- type SrcVersion
- type SubClientCmd
- type SubFrameworkCmd
- type SubLibraryCmd
- type SubUmbrellaCmd
- type SymsegCmd
- type SymtabCmd
- type ThreadCmd
- type ThreadFlavor
- type ThreadState
- type TlvDescriptor
- type Tool
- type TwolevelHint
- type TwolevelHintsCmd
- type UUID
- type UUIDCmd
- type UnixThreadCmd
- type VMAddrConverter
- type Version
- type VersionMinCmd
- type VersionMinIPhoneOSCmd
- type VersionMinMacOSCmd
- type VersionMinTvOSCmd
- type VersionMinWatchOSCmd
- type VmProtection
- type WriteAtBuffer
- type X86ThreadFlavor
Constants ¶
const ( // // x86 flavors // X86_THREAD_STATE32 X86ThreadFlavor = 1 X86_FLOAT_STATE32 X86ThreadFlavor = 2 X86_EXCEPTION_STATE32 X86ThreadFlavor = 3 X86_THREAD_STATE64 X86ThreadFlavor = 4 X86_FLOAT_STATE64 X86ThreadFlavor = 5 X86_EXCEPTION_STATE64 X86ThreadFlavor = 6 X86_THREAD_STATE X86ThreadFlavor = 7 X86_FLOAT_STATE X86ThreadFlavor = 8 X86_EXCEPTION_STATE X86ThreadFlavor = 9 X86_DEBUG_STATE32 X86ThreadFlavor = 10 X86_DEBUG_STATE64 X86ThreadFlavor = 11 X86_DEBUG_STATE X86ThreadFlavor = 12 X86_THREAD_STATE_NONE X86ThreadFlavor = 13 /* 14 and 15 are used for the internal X86_SAVED_STATE flavours */ /* Arrange for flavors to take sequential values, 32-bit, 64-bit, non-specific */ X86_AVX_STATE32 X86ThreadFlavor = 16 X86_AVX_STATE64 X86ThreadFlavor = (X86_AVX_STATE32 + 1) X86_AVX_STATE X86ThreadFlavor = (X86_AVX_STATE32 + 2) X86_AVX512_STATE32 X86ThreadFlavor = 19 X86_AVX512_STATE64 X86ThreadFlavor = (X86_AVX512_STATE32 + 1) X86_AVX512_STATE X86ThreadFlavor = (X86_AVX512_STATE32 + 2) X86_PAGEIN_STATE X86ThreadFlavor = 22 X86_THREAD_FULL_STATE64 X86ThreadFlavor = 23 X86_INSTRUCTION_STATE X86ThreadFlavor = 24 X86_LAST_BRANCH_STATE X86ThreadFlavor = 25 // // arm flavors // ARM_THREAD_STATE ArmThreadFlavor = 1 ARM_UNIFIED_THREAD_STATE ArmThreadFlavor = ARM_THREAD_STATE ARM_VFP_STATE ArmThreadFlavor = 2 ARM_EXCEPTION_STATE ArmThreadFlavor = 3 ARM_DEBUG_STATE ArmThreadFlavor = 4 /* pre-armv8 */ ARM_THREAD_STATE_NONE ArmThreadFlavor = 5 ARM_THREAD_STATE64 ArmThreadFlavor = 6 ARM_EXCEPTION_STATE64 ArmThreadFlavor = 7 // ARM_THREAD_STATE_LAST 8 /* legacy */ ARM_THREAD_STATE32 ArmThreadFlavor = 9 /* API */ ARM_DEBUG_STATE32 ArmThreadFlavor = 14 ARM_DEBUG_STATE64 ArmThreadFlavor = 15 ARM_NEON_STATE ArmThreadFlavor = 16 ARM_NEON_STATE64 ArmThreadFlavor = 17 ARM_CPMU_STATE64 ArmThreadFlavor = 18 ARM_PAGEIN_STATE ArmThreadFlavor = 27 )
const ( /* * An indirect symbol table entry is simply a 32bit index into the symbol table * to the symbol that the pointer or stub is refering to. Unless it is for a * non-lazy symbol pointer section for a defined symbol which strip(1) as * removed. In which case it has the value INDIRECT_SYMBOL_LOCAL. If the * symbol was also absolute INDIRECT_SYMBOL_ABS is or'ed with that. */ INDIRECT_SYMBOL_LOCAL = 0x80000000 // TODO: use this ? INDIRECT_SYMBOL_ABS = 0x40000000 )
const ( /* Capability bits used in the definition of cpu_subtype. */ CpuSubtypeFeatureMask CPUSubtype = 0xff000000 /* mask for feature flags */ CpuSubtypeMask = CPUSubtype(^CpuSubtypeFeatureMask) /* mask for cpu subtype */ CpuSubtypeLib64 = 0x80000000 /* 64 bit libraries */ /* CPU subtype capability flags for ptrauth on arm64e platforms */ CpuSubtypeArm64PtrAuthMask = 0x0f000000 /* CPU subtype capability flags for ptrauth on arm64e platforms, take 2 */ CpuSubtypeArm64eVersionedAbiMask = 0x80000000 CpuSubtypeArm64eKernelAbiMask = 0x40000000 CpuSubtypeArm64ePtrAuthMask = 0x3f000000 /* * 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 )
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_TYPE_THREADED_BIND = 100 BIND_TYPE_THREADED_REBASE = 102 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 ( FileHeaderSize32 = 7 * 4 FileHeaderSize64 = 8 * 4 )
const ( /* * If the type is N_SECT then the n_sect field contains an ordinal of the * section the symbol is defined in. The sections are numbered from 1 and * refer to sections in order they appear in the load commands for the file * they are in. This means the same ordinal may very well refer to different * sections in different files. * * The n_value field for all symbol table entries (including N_STAB's) gets * updated by the link editor based on the value of it's n_sect field and where * the section n_sect references gets relocated. If the value of the n_sect * field is NO_SECT then it's n_value field is not changed by the link editor. */ NO_SECT = 0 /* symbol is not in any section */ MAX_SECT = 255 /* 1 thru 255 inclusive */ )
const ( SELF_LIBRARY_ORDINAL = 0x0 MAX_LIBRARY_ORDINAL = 0xfd DYNAMIC_LOOKUP_ORDINAL = 0xfe EXECUTABLE_ORDINAL = 0xff )
const DYLIB_USE_MARKER = 0x1a741800
Variables ¶
This section is empty.
Functions ¶
func ExtractBits ¶
Types ¶
type ArmThreadFlavor ¶
type ArmThreadFlavor ThreadFlavor
func (ArmThreadFlavor) String ¶
func (i ArmThreadFlavor) String() string
type Bind ¶
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 */ }
* BuildVersionCmd 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 BuildVersionTool ¶
type BuildVersionTool struct { Tool Tool /* enum for the tool */ Version Version /* version number of the tool */ }
func (*BuildVersionTool) MarshalJSON ¶
func (b *BuildVersionTool) MarshalJSON() ([]byte, error)
type CPU ¶
type CPU uint32
A CPU is a Mach-O cpu type.
const ( CPUVax CPU = 1 CPUMC680x0 CPU = 6 CPUX86 CPU = 7 CPUI386 CPU = CPUX86 /* compatibility */ CPUAmd64 CPU = CPUX86 | cpuArch64 CPUMips CPU = 8 CPUMc98000 CPU = 10 CPUHppa CPU = 11 CPUArm CPU = 12 CPUArm64 CPU = CPUArm | cpuArch64 CPUArm6432 CPU = CPUArm | cpuArch6432 CPUMc88000 CPU = 13 CPUSparc CPU = 14 CPUI860 CPU = 15 CPUPpc CPU = 18 CPUPpc64 CPU = CPUPpc | cpuArch64 )
type CPUSubtype ¶
type CPUSubtype uint32
const ( CPUSubtypeVaxAll CPUSubtype = 0 CPUSubtypeVax780 CPUSubtype = 1 CPUSubtypeVax785 CPUSubtype = 2 CPUSubtypeVax750 CPUSubtype = 3 CPUSubtypeVax730 CPUSubtype = 4 CPUSubtypeUVaxI CPUSubtype = 5 CPUSubtypeUVaxII CPUSubtype = 6 CPUSubtypeVax8200 CPUSubtype = 7 CPUSubtypeVax8500 CPUSubtype = 8 CPUSubtypeVax8600 CPUSubtype = 9 CPUSubtypeVax8650 CPUSubtype = 10 CPUSubtypeVax8800 CPUSubtype = 11 CPUSubtypeUVaxIII CPUSubtype = 12 )
VAX subtypes
const ( CPUSubtypeMC680x0All CPUSubtype = 1 CPUSubtypeMC68030 CPUSubtype = 1 CPUSubtypeMC68040 CPUSubtype = 2 CPUSubtypeMC68030Only CPUSubtype = 3 )
680x0 subtypes
const ( CPUSubtypeI386All CPUSubtype = 3 + 0<<4 CPUSubtypeI386386 CPUSubtype = 3 + 0<<4 CPUSubtypeI386486 CPUSubtype = 4 + 0<<4 CPUSubtypeI386486SX CPUSubtype = 4 + 8<<4 CPUSubtypeI386586 CPUSubtype = 5 + 0<<4 CPUSubtypeI386Pent CPUSubtype = 5 + 0<<4 CPUSubtypeI386PentPro CPUSubtype = 6 + 1<<4 CPUSubtypeI386PentIIM3 CPUSubtype = 6 + 3<<4 CPUSubtypeI386PentIIM5 CPUSubtype = 6 + 5<<4 CPUSubtypeI386Celeron CPUSubtype = 7 + 6<<4 CPUSubtypeI386CeleronMobile CPUSubtype = 7 + 7<<4 CPUSubtypeI386Pentium3 CPUSubtype = 8 + 0<<4 CPUSubtypeI386Pentium3M CPUSubtype = 8 + 1<<4 CPUSubtypeI386Pentium3Xeon CPUSubtype = 8 + 2<<4 CPUSubtypeI386PentiumM CPUSubtype = 9 + 0<<4 CPUSubtypeI386Pentium4 CPUSubtype = 10 + 0<<4 CPUSubtypeI386Pentium4M CPUSubtype = 10 + 1<<4 CPUSubtypeI386Itanium CPUSubtype = 11 + 0<<4 CPUSubtypeI386Itanium2 CPUSubtype = 11 + 1<<4 CPUSubtypeI386Xeon CPUSubtype = 12 + 0<<4 CPUSubtypeI386XeonMP CPUSubtype = 12 + 1<<4 )
I386 subtypes
const ( CPUSubtypeX86All CPUSubtype = 3 CPUSubtypeX8664All CPUSubtype = 3 CPUSubtypeX86Arch1 CPUSubtype = 4 CPUSubtypeX86_64H CPUSubtype = 8 )
X86 subtypes
const ( CPUSubtypeMipsAll CPUSubtype = 0 CPUSubtypeMipsR2300 CPUSubtype = 1 CPUSubtypeMipsR2600 CPUSubtype = 2 CPUSubtypeMipsR2800 CPUSubtype = 3 CPUSubtypeMipsR2000a CPUSubtype = 4 // pmax CPUSubtypeMipsR2000 CPUSubtype = 5 CPUSubtypeMipsR3000a CPUSubtype = 6 // 3max CPUSubtypeMipsR3000 CPUSubtype = 7 )
Mips subtypes.
const ( CPUSubtypeMc98000All CPUSubtype = 0 CPUSubtypeMc98601 CPUSubtype = 1 )
MC98000 (PowerPC) subtypes
const ( CPUSubtypeHppaAll CPUSubtype = 0 CPUSubtypeHppa7100 CPUSubtype = 0 // compat CPUSubtypeHppa7100LC CPUSubtype = 1 )
HPPA subtypes for Hewlett-Packard HP-PA family of risc processors. Port by NeXT to 700 series.
const ( CPUSubtypeMc88000All CPUSubtype = 0 CPUSubtypeMc88100 CPUSubtype = 1 CPUSubtypeMc88110 CPUSubtype = 2 )
MC88000 subtypes
const ( CPUSubtypeI860All CPUSubtype = 0 CPUSubtypeI860_860 CPUSubtype = 1 )
I860 subtypes
const ( CPUSubtypePowerPCAll CPUSubtype = 0 CPUSubtypePowerPC601 CPUSubtype = 1 CPUSubtypePowerPC602 CPUSubtype = 2 CPUSubtypePowerPC603 CPUSubtype = 3 CPUSubtypePowerPC603e CPUSubtype = 4 CPUSubtypePowerPC603ev CPUSubtype = 5 CPUSubtypePowerPC604 CPUSubtype = 6 CPUSubtypePowerPC604e CPUSubtype = 7 CPUSubtypePowerPC620 CPUSubtype = 8 CPUSubtypePowerPC750 CPUSubtype = 9 CPUSubtypePowerPC7400 CPUSubtype = 10 CPUSubtypePowerPC7450 CPUSubtype = 11 CPUSubtypePowerPC970 CPUSubtype = 100 )
PowerPC 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
const ( CPUSubtypeArm6432All CPUSubtype = 0 CPUSubtypeArm6432V8 CPUSubtype = 1 )
ARM64_32 subtypes
const (
CPUSubtypeSparcAll CPUSubtype = 0
)
SPARC subtypes
func (CPUSubtype) Capabilities ¶
func (st CPUSubtype) Capabilities(cpu CPU) string
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 CustomSectionReader ¶
type CustomSectionReader struct {
// contains filtered or unexported fields
}
CustomSectionReader implements Read, Seek, and ReadAt on a section of an underlying ReaderAt. It also stubs out the MachoReader required SeekToAddr and ReadAtAddr
func NewCustomSectionReader ¶
func NewCustomSectionReader(r io.ReaderAt, vma *VMAddrConverter, off int64, n int64) *CustomSectionReader
NewCustomSectionReader returns a CustomSectionReader that reads from r starting at offset off and stops with EOF after n bytes.
func (*CustomSectionReader) ReadAt ¶
func (s *CustomSectionReader) ReadAt(p []byte, off int64) (n int, err error)
func (*CustomSectionReader) ReadAtAddr ¶
func (s *CustomSectionReader) ReadAtAddr(buf []byte, addr uint64) (int, error)
func (*CustomSectionReader) Seek ¶
func (s *CustomSectionReader) Seek(offset int64, whence int) (int64, error)
func (*CustomSectionReader) SeekToAddr ¶
func (s *CustomSectionReader) SeekToAddr(addr uint64) error
func (*CustomSectionReader) Size ¶
func (s *CustomSectionReader) Size() int64
Size returns the size of the section in bytes.
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 or LC_DYLD_INFO_ONLY Len uint32 // sizeof(struct dyld_info_command) /* * Dyld rebases an image whenever dyld loads it at an address different * from its preferred address. The rebase information is a stream * of byte sized opcodes whose symbolic names start with REBASE_OPCODE_. * Conceptually the rebase information is a table of tuples: * <seg-index, seg-offset, type> * The opcodes are a compressed way to encode the table by only * encoding when a column changes. In addition simple patterns * like "every n'th offset for m times" can be encoded in a few * bytes. */ RebaseOff uint32 // file offset to rebase info RebaseSize uint32 // size of rebase info /* * Dyld binds an image during the loading process, if the image * requires any pointers to be initialized to symbols in other images. * The bind information is a stream of byte sized * opcodes whose symbolic names start with BIND_OPCODE_. * Conceptually the bind information is a table of tuples: * <seg-index, seg-offset, type, symbol-library-ordinal, symbol-name, addend> * The opcodes are a compressed way to encode the table by only * encoding when a column changes. In addition simple patterns * like for runs of pointers initialzed to the same value can be * encoded in a few bytes. */ BindOff uint32 // file offset to binding info BindSize uint32 // size of binding info /* * Some C++ programs require dyld to unique symbols so that all * images in the process use the same copy of some code/data. * This step is done after binding. The content of the weak_bind * info is an opcode stream like the bind_info. But it is sorted * alphabetically by symbol name. This enable dyld to walk * all images with weak binding information in order and look * for collisions. If there are no collisions, dyld does * no updating. That means that some fixups are also encoded * in the bind_info. For instance, all calls to "operator new" * are first bound to libstdc++.dylib using the information * in bind_info. Then if some image overrides operator new * that is detected when the weak_bind information is processed * and the call to operator new is then rebound. */ WeakBindOff uint32 // file offset to weak binding info WeakBindSize uint32 // size of weak binding info /* * Some uses of external symbols do not need to be bound immediately. * Instead they can be lazily bound on first use. The lazy_bind * are contains a stream of BIND opcodes to bind all lazy symbols. * Normal use is that dyld ignores the lazy_bind section when * loading an image. Instead the static linker arranged for the * lazy pointer to initially point to a helper function which * pushes the offset into the lazy_bind area for the symbol * needing to be bound, then jumps to dyld which simply adds * the offset to lazy_bind_off to get the information on what * to bind. */ LazyBindOff uint32 // file offset to lazy binding info LazyBindSize uint32 // size of lazy binding info /* * The symbols exported by a dylib are encoded in a trie. This * is a compact representation that factors out common prefixes. * It also reduces LINKEDIT pages in RAM because it encodes all * information (name, address, flags) in one small, contiguous range. * The export area is a stream of nodes. The first node sequentially * is the start node for the trie. * * Nodes for a symbol start with a uleb128 that is the length of * the exported symbol information for the string so far. * If there is no exported symbol, the node starts with a zero byte. * If there is exported info, it follows the length. * * First is a uleb128 containing flags. Normally, it is followed by * a uleb128 encoded offset which is location of the content named * by the symbol from the mach_header for the image. If the flags * is EXPORT_SYMBOL_FLAGS_REEXPORT, then following the flags is * a uleb128 encoded library ordinal, then a zero terminated * UTF8 string. If the string is zero length, then the symbol * is re-export from the specified dylib with the same name. * If the flags is EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER, then following * the flags is two uleb128s: the stub offset and the resolver offset. * The stub is used by non-lazy pointers. The resolver is used * by lazy pointers and must be called to get the actual address to use. * * After the optional exported symbol information is a byte of * how many edges (0-255) that this node has leaving it, * followed by each edge. * Each edge is a zero terminated UTF8 of the addition chars * in the symbol, followed by a uleb128 offset for the node that * edge points to. * */ ExportOff uint32 // file offset to export info ExportSize uint32 // size of export info }
* DyldInfoCmd contains the file offsets and sizes of * the new compressed form of the information dyld needs to * load the image. This information is used by dyld on Mac OS X * 10.6 and later. All information pointed to by this command * is encoded using byte streams, so no endian swapping is needed * to interpret it.
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_ID_DYLIB, LC_LOAD_{,WEAK_}DYLIB, LC_REEXPORT_DYLIB */ Len uint32 /* includes pathname string */ /* * Dynamicly linked shared libraries are identified by two things. The * pathname (the name of the library as found for execution), and the * compatibility version number. The pathname must match and the compatibility * number in the user of the library must be greater than or equal to the * library being used. The time stamp is used to record the time a library was * built and copied into user so it can be use to determined if the library used * at runtime is exactly the same as used to built the program. */ NameOffset uint32 Timestamp uint32 CurrentVersion Version CompatVersion Version }
* DylibCmd a dynamically linked shared library (filetype == MH_DYLIB in the mach header) * contains a dylib_command (cmd == LC_ID_DYLIB) to identify the library. * An object that uses a dynamically linked shared library also contains a * dylib_command (cmd == LC_LOAD_DYLIB, LC_LOAD_WEAK_DYLIB, or * LC_REEXPORT_DYLIB) for each library it uses.
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 DylibModule ¶
type DylibModule struct { ModuleName uint32 /* the module name (index into string table) */ Iextdefsym uint32 /* index into externally defined symbols */ Nextdefsym uint32 /* number of externally defined symbols */ Irefsym uint32 /* index into reference symbol table */ Nrefsym uint32 /* number of reference symbol table entries */ Ilocalsym uint32 /* index into symbols for local symbols */ Nlocalsym uint32 /* number of local symbols */ Iextrel uint32 /* index into external relocation entries */ Nextrel uint32 /* number of external relocation entries */ IinitIterm uint32 /* low 16 bits are the index into the init section, high 16 bits are the index into the term section */ NinitNterm uint32 /* low 16 bits are the number of init section entries, high 16 bits are the number of term section entries */ /* for this module address of the start of */ ObjcModuleInfoAddr uint32 /* the (__OBJC,__module_info) section */ /* for this module size of */ ObjcModuleInfoSize uint32 /* the (__OBJC,__module_info) section */ }
a module table entry
type DylibModule64 ¶
type DylibModule64 struct { ModuleName uint32 /* the module name (index into string table) */ Iextdefsym uint32 /* index into externally defined symbols */ Nextdefsym uint32 /* number of externally defined symbols */ Irefsym uint32 /* index into reference symbol table */ Nrefsym uint32 /* number of reference symbol table entries */ Ilocalsym uint32 /* index into symbols for local symbols */ Nlocalsym uint32 /* number of local symbols */ Iextrel uint32 /* index into external relocation entries */ Nextrel uint32 /* number of external relocation entries */ IinitIterm uint32 /* low 16 bits are the index into the init section, high 16 bits are the index into the term section */ NinitNterm uint32 /* low 16 bits are the number of init section entries, high 16 bits are the number of term section entries */ /* for this module size of */ ObjcModuleInfoSize uint32 /* the (__OBJC,__module_info) section */ /* for this module address of the start of */ ObjcModuleInfoAddr uint64 /* the (__OBJC,__module_info) section */ }
a 64-bit module table entry
type DylibReference ¶
type DylibReference uint32
- The entries in the reference symbol table are used when loading the module
- (both by the static and dynamic link editors) and if the module is unloaded
- or replaced. Therefore all external symbols (defined and undefined) are
- listed in the module's reference table. The flags describe the type of
- reference that is being made. The constants for the flags are defined in
- <mach-o/nlist.h> as they are also used for symbol table entries.
isym:24, /* index into the symbol table */ flags:8; /* flags to indicate the type of reference */
func (DylibReference) Flags ¶
func (d DylibReference) Flags() uint8
func (DylibReference) SymIndex ¶
func (d DylibReference) SymIndex() uint32
type DylibTableOfContents ¶
type DylibTableOfContents struct { SymbolIndex uint32 /* the defined external symbol (index into the symbol table) */ ModuleIndex uint32 /* index into the module table this symbol is defined in */ }
a table of contents entry
type DylibUseCmd ¶
type DylibUseCmd struct { LoadCmd /* LC_LOAD_DYLIB or LC_LOAD_WEAK_DYLIB */ Len uint32 /* overall size, including path */ NameOffset uint32 /* == 28, dylibs's path offset */ Marker uint32 /* == DYLIB_USE_MARKER */ CurrentVersion uint32 /* dylib's current version number */ CompatVersion uint32 /* dylib's compatibility version number */ Flags DylibUseFlags /* DYLIB_USE_... flags */ }
* DylibUseCmd is an alternate encoding for: LC_LOAD_DYLIB. * The flags field contains independent flags DYLIB_USE_* * First supported in macOS 15, iOS 18.
type DylibUseFlags ¶
type DylibUseFlags uint32
const ( DYLIB_USE_WEAK_LINK DylibUseFlags = 0x01 DYLIB_USE_REEXPORT DylibUseFlags = 0x02 DYLIB_USE_UPWARD DylibUseFlags = 0x04 DYLIB_USE_DELAYED_INIT DylibUseFlags = 0x08 )
type DylinkerCmd ¶
type DylinkerCmd struct { LoadCmd // LC_ID_DYLINKER, LC_LOAD_DYLINKER or LC_DYLD_ENVIRONMENT Len uint32 // includes pathname string NameOffset uint32 // dynamic linker's path name }
* DylinkerCmd a program that uses a dynamic linker contains a dylinker_command to identify * the name of the dynamic linker (LC_LOAD_DYLINKER). And a dynamic linker * contains a dylinker_command to identify the dynamic linker (LC_ID_DYLINKER). * A file can have at most one of these. * This struct is also used for the LC_DYLD_ENVIRONMENT load command and * contains string for dyld to treat like environment variable.
type DysymtabCmd ¶
type DysymtabCmd struct { LoadCmd // LC_DYSYMTAB Len uint32 // sizeof(struct dysymtab_command) /* * The symbols indicated by symoff and nsyms of the LC_SYMTAB load command * are grouped into the following three groups: * local symbols (further grouped by the module they are from) * defined external symbols (further grouped by the module they are from) * undefined symbols * * The local symbols are used only for debugging. The dynamic binding * process may have to use them to indicate to the debugger the local * symbols for a module that is being bound. * * The last two groups are used by the dynamic binding process to do the * binding (indirectly through the module table and the reference symbol * table when this is a dynamically linked shared library file). */ Ilocalsym uint32 // index to local symbols Nlocalsym uint32 // number of local symbols Iextdefsym uint32 // index to externally defined symbols Nextdefsym uint32 // number of externally defined symbols Iundefsym uint32 // index to undefined symbols Nundefsym uint32 // number of undefined symbols /* * For the for the dynamic binding process to find which module a symbol * is defined in the table of contents is used (analogous to the ranlib * structure in an archive) which maps defined external symbols to modules * they are defined in. This exists only in a dynamically linked shared * library file. For executable and object modules the defined external * symbols are sorted by name and is use as the table of contents. */ Tocoffset uint32 // file offset to table of contents Ntoc uint32 // number of entries in table of contents /* * To support dynamic binding of "modules" (whole object files) the symbol * table must reflect the modules that the file was created from. This is * done by having a module table that has indexes and counts into the merged * tables for each module. The module structure that these two entries * refer to is described below. This exists only in a dynamically linked * shared library file. For executable and object modules the file only * contains one module so everything in the file belongs to the module. */ Modtaboff uint32 // file offset to module table Nmodtab uint32 // number of module table entries /* * To support dynamic module binding the module structure for each module * indicates the external references (defined and undefined) each module * makes. For each module there is an offset and a count into the * reference symbol table for the symbols that the module references. * This exists only in a dynamically linked shared library file. For * executable and object modules the defined external symbols and the * undefined external symbols indicates the external references. */ Extrefsymoff uint32 // offset to referenced symbol table Nextrefsyms uint32 // number of referenced symbol table entries /* * The sections that contain "symbol pointers" and "routine stubs" have * indexes and (implied counts based on the size of the section and fixed * size of the entry) into the "indirect symbol" table for each pointer * and stub. For every section of these two types the index into the * indirect symbol table is stored in the section header in the field * reserved1. An indirect symbol table entry is simply a 32bit index into * the symbol table to the symbol that the pointer or stub is referring to. * The indirect symbol table is ordered to match the entries in the section. */ Indirectsymoff uint32 // file offset to the indirect symbol table Nindirectsyms uint32 // number of indirect symbol table entries /* * To support relocating an individual module in a library file quickly the * external relocation entries for each module in the library need to be * accessed efficiently. Since the relocation entries can't be accessed * through the section headers for a library file they are separated into * groups of local and external entries further grouped by module. In this * case the presents of this load command who's extreloff, nextrel, * locreloff and nlocrel fields are non-zero indicates that the relocation * entries of non-merged sections are not referenced through the section * structures (and the reloff and nreloc fields in the section headers are * set to zero). * * Since the relocation entries are not accessed through the section headers * this requires the r_address field to be something other than a section * offset to identify the item to be relocated. In this case r_address is * set to the offset from the vmaddr of the first LC_SEGMENT command. * For MH_SPLIT_SEGS images r_address is set to the the offset from the * vmaddr of the first read-write LC_SEGMENT command. * * The relocation entries are grouped by module and the module table * entries have indexes and counts into them for the group of external * relocation entries for that the module. * * For sections that are merged across modules there must not be any * remaining external relocation entries for them (for merged sections * remaining relocation entries must be local). */ Extreloff uint32 // offset to external relocation entries Nextrel uint32 // number of external relocation entries /* * All the local relocation entries are grouped together (they are not * grouped by their module since they are only used if the object is moved * from it staticly link edited address). */ Locreloff uint32 // offset to local relocation entries Nlocrel uint32 // number of local relocation entries }
* DysymtabCmd is the second set of the symbolic information which is used to support * the data structures for the dynamically link editor. * * The original set of symbolic information in the symtab_command which contains * the symbol and string tables must also be present when this load command is * present. When this load command is present the symbol table is organized * into three groups of symbols: * local symbols (static and debugging symbols) - grouped by module * defined external symbols - grouped by module (sorted by name if not lib) * undefined external symbols (sorted by name if MH_BINDATLOAD is not set, * and in order the were seen by the static * linker if MH_BINDATLOAD is set) * In this load command there are offsets and counts to each of the three groups * of symbols. * * This load command contains a the offsets and sizes of the following new * symbolic information tables: * table of contents * module table * reference symbol table * indirect symbol table * The first three tables above (the table of contents, module table and * reference symbol table) are only present if the file is a dynamically linked * shared library. For executable and object modules, which are files * containing only one module, the information that would be in these three * tables is determined as follows: * table of contents - the defined external symbols are sorted by name * module table - the file contains only one module so everything in the * file is part of the module. * reference symbol table - is the defined and undefined external symbols * * For dynamically linked shared library files this load command also contains * offsets and sizes to the pool of relocation entries for all sections * separated into two groups: * external relocation entries * local relocation entries * For executable and object modules the relocation entries continue to hang * off the section structures.
type EncryptionInfo64Cmd ¶
type EncryptionInfo64Cmd struct { LoadCmd // LC_ENCRYPTION_INFO_64 Len uint32 // sizeof(struct encryption_info_command_64) 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 }
* EncryptionInfo64Cmd contains the file offset and size of an * of an encrypted segment (for use in x86_64 targets).
type EncryptionInfoCmd ¶
type EncryptionInfoCmd struct { LoadCmd // LC_ENCRYPTION_INFO Len uint32 // sizeof(struct encryption_info_command) Offset uint32 // file offset of encrypted range Size uint32 // file size of encrypted range CryptID EncryptionSystem // which enryption system, 0 means not-encrypted yet }
* EncryptionInfoCmd contains the file offset and size of an * of an encrypted segment.
type EntryPointCmd ¶
type EntryPointCmd struct { LoadCmd // LC_MAIN only used in MH_EXECUTE filetypes Len uint32 // 24 EntryOffset uint64 // file (__TEXT) offset of main() StackSize uint64 // if not zero, initial stack size }
* EntryPointCmd is a replacement for thread_command. * It is used for main executables to specify the location (file offset) * of main(). If -stack_size was used at link time, the stacksize * field will contain the stack size need for the main thread.
type ExportFlag ¶
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 EXPORT_SYMBOL_FLAGS_STATIC_RESOLVER ExportFlag = 0x20 )
func (ExportFlag) Absolute ¶
func (f ExportFlag) Absolute() bool
func (ExportFlag) ReExport ¶
func (f ExportFlag) ReExport() bool
func (ExportFlag) Regular ¶
func (f ExportFlag) Regular() bool
func (ExportFlag) StaticResolver ¶
func (f ExportFlag) StaticResolver() bool
func (ExportFlag) String ¶
func (f ExportFlag) String() string
func (ExportFlag) StubAndResolver ¶
func (f ExportFlag) StubAndResolver() bool
func (ExportFlag) ThreadLocal ¶
func (f ExportFlag) ThreadLocal() bool
func (ExportFlag) WeakDefinition ¶
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) MarshalJSON ¶
func (h *FileHeader) MarshalJSON() ([]byte, error)
func (*FileHeader) Print ¶
func (h *FileHeader) Print(printer func(h *FileHeader) string) string
func (*FileHeader) String ¶
func (h *FileHeader) String() string
type FilePointer ¶
type FilesetEntryCmd ¶
type FilesetEntryCmd struct { LoadCmd // LC_FILESET_ENTRY Len uint32 Addr uint64 // memory address of the entry FileOffset uint64 // file offset of the entry EntryIdOffset 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 // includes pathname string NameOffset uint32 // files pathname HeaderAddr uint32 // files virtual address }
* FvmFileCmdcontains a reference to a file to be loaded at the * specified virtual address. (Presently, this command is reserved for * internal use. The kernel ignores this command when loading a program into * memory).
type HeaderFileType ¶
type HeaderFileType uint32
A HeaderFileType is the Mach-O file type, e.g. an object file, executable, or dynamic library.
const ( MH_OBJECT HeaderFileType = 0x1 /* relocatable object file */ MH_EXECUTE HeaderFileType = 0x2 /* demand paged executable file */ MH_FVMLIB HeaderFileType = 0x3 /* fixed VM shared library file */ MH_CORE HeaderFileType = 0x4 /* core file */ MH_PRELOAD HeaderFileType = 0x5 /* preloaded executable file */ MH_DYLIB HeaderFileType = 0x6 /* dynamically bound shared library */ MH_DYLINKER HeaderFileType = 0x7 /* dynamic link editor */ MH_BUNDLE HeaderFileType = 0x8 /* dynamically bound bundle file */ MH_DYLIB_STUB HeaderFileType = 0x9 /* shared library stub for static linking only, no section contents */ MH_DSYM HeaderFileType = 0xa /* companion file with only debug sections */ MH_KEXT_BUNDLE HeaderFileType = 0xb /* x86_64 kexts */ MH_FILESET HeaderFileType = 0xc /* a file composed of other Mach-Os to be run in the same userspace sharing a single linkedit. */ MH_GPU_EXECUTE HeaderFileType = 0xd /* gpu program */ MH_GPU_DYLIB HeaderFileType = 0xe /* gpu support functions */ )
func (HeaderFileType) String ¶
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 ImplicitPagezero HeaderFlag = 0x10000000 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) ImplicitPagezero ¶
func (f HeaderFlag) ImplicitPagezero() bool
func (HeaderFlag) IncrLink ¶
func (f HeaderFlag) IncrLink() bool
func (HeaderFlag) LazyInit ¶
func (f HeaderFlag) LazyInit() bool
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
func (HeaderFlag) None ¶
func (f HeaderFlag) None() 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) Set ¶
func (f *HeaderFlag) Set(flag HeaderFlag, set 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 (f 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 IDDylibCmd ¶
type IDDylibCmd DylibCmd // LC_ID_DYLIB
A IDDylibCmd represents a Mach-O load dynamic library ident command.
type IDDylinkerCmd ¶
type IDDylinkerCmd DylinkerCmd // LC_ID_DYLINKER
A IDDylinkerCmd is a Mach-O dynamic linker identification command.
type IDFvmLibCmd ¶
type IDFvmLibCmd LoadFvmLibCmd // LC_IDFVMLIB
A IDFvmLibCmd is a Mach-O fixed VM shared library identification command.
type IdentCmd ¶
* IdentCmd contains a free format string table following the * ident_command structure. The strings are null terminated and the size of * the command is padded out with zero bytes to a multiple of 4 bytes/ * (THIS IS OBSOLETE and no longer supported).
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 /* LC_CODE_SIGNATURE, LC_SEGMENT_SPLIT_INFO, LC_FUNCTION_STARTS, LC_DATA_IN_CODE, LC_DYLIB_CODE_SIGN_DRS, LC_ATOM_INFO, LC_LINKER_OPTIMIZATION_HINT, LC_DYLD_EXPORTS_TRIE, or LC_DYLD_CHAINED_FIXUPS. */ Len uint32 // sizeof(struct linkedit_data_command) Offset uint32 // file offset of data in __LINKEDIT segment Size uint32 // file size of data in __LINKEDIT segment }
* LinkEditDataCmd contains the offsets and sizes of a blob * of data in the __LINKEDIT segment.
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 // sizeof(struct linker_option_command) Count uint32 // number of strings concatenation of zero terminated UTF8 strings. Zero filled at end to align }
* LinkerOptionCmd contains linker options embedded in object files.
type LoadCmd ¶
type LoadCmd uint32
A LoadCmd is a Mach-O load command.
const ( LC_REQ_DYLD LoadCmd = 0x80000000 LC_SEP LoadCmd = 0x8000000 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 */ LC_ATOM_INFO LoadCmd = 0x36 /* used with linkedit_data_command */ /* * sep load commands */ LC_SEP_CACHE_SLIDE LoadCmd = (0x1 | LC_SEP) LC_SEP_UNKNOWN_2 LoadCmd = (0x2 | LC_SEP) LC_SEP_UNKNOWN_3 LoadCmd = (0x3 | LC_SEP) )
type LoadDylibCmd ¶
type LoadDylibCmd DylibCmd // LC_LOAD_DYLIB
A LoadDylibCmd load a dynamically linked shared library.
type LoadFvmLibCmd ¶
type LoadFvmLibCmd struct { LoadCmd // LC_IDFVMLIB or LC_LOADFVMLIB Len uint32 /* includes pathname string */ /* * Fixed virtual memory shared libraries are identified by two things. The * target pathname (the name of the library as found for execution), and the * minor version number. The address of where the headers are loaded is in * header_addr. (THIS IS OBSOLETE and no longer supported). */ NameOffset uint32 // library's target pathname MinorVersion Version /* library's minor version number */ HeaderAddr uint32 /* library's header address */ }
* LoadFvmLibCmd a fixed virtual shared library (filetype == MH_FVMLIB in the mach header) * contains a fvmlib_command (cmd == LC_IDFVMLIB) to identify the library. * An object that uses a fixed virtual shared library also contains a * fvmlib_command (cmd == LC_LOADFVMLIB) for each library it uses. * (THIS IS OBSOLETE and no longer supported).
type LoadUpwardDylibCmd ¶
type LoadUpwardDylibCmd DylibCmd // LC_LOAD_UPWARD_DYLIB
A LoadUpwardDylibCmd is a Mach-O load upward dylibcommand.
type LoadWeakDylibCmd ¶
type LoadWeakDylibCmd DylibCmd // LC_LOAD_WEAK_DYLIB
A LoadWeakDylibCmd is a Mach-O load a dynamically linked shared library that is allowed to be missing (all symbols are weak imported) command.
type MachoReader ¶
type MachoReader interface { io.ReadSeeker io.ReaderAt SeekToAddr(addr uint64) error ReadAtAddr(buf []byte, addr uint64) (int, error) }
MachoReader is a custom io.SectionReader interface with virtual address support
type NDescType ¶
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 ( /* * To simplify stripping of objects that use are used with the dynamic link * editor, the static link editor marks the symbols defined an object that are * referenced by a dynamicly bound object (dynamic shared libraries, bundles). * With this marking strip knows not to strip these symbols. */ REFERENCED_DYNAMICALLY NDescType = 0x0010 /* * 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_MASK NDescType = 0x7
func (NDescType) GetCommAlign ¶
* Common symbols are represented by undefined (N_UNDF) external (N_EXT) types * who's values (n_value) are non-zero. In which case the value of the n_value * field is the size (in bytes) of the common symbol. The n_sect field is set * to NO_SECT. The alignment of a common symbol may be set as a power of 2 * between 2^1 and 2^15 as part of the n_desc field using the macros below. If * the alignment is not set (a value of zero) then natural alignment based on * the size is used.
func (NDescType) GetLibraryOrdinal ¶
func (NDescType) IsAltEntry ¶
func (NDescType) IsArmThumbDefintion ¶
func (NDescType) IsColdFunc ¶
func (NDescType) IsDescDiscarded ¶
func (NDescType) IsNoDeadStrip ¶
func (NDescType) IsPrivateDefined ¶
func (NDescType) IsPrivateUndefinedLazy ¶
func (NDescType) IsPrivateUndefinedNonLazy ¶
func (NDescType) IsReferenceToWeak ¶
func (NDescType) IsReferencedDynamically ¶
func (NDescType) IsSymbolResolver ¶
func (NDescType) IsUndefinedLazy ¶
func (NDescType) IsUndefinedNonLazy ¶
func (NDescType) IsWeakDefintion ¶
func (NDescType) IsWeakDefintionOrReferenced ¶
func (NDescType) IsWeakReferenced ¶
type NType ¶
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.
const ( N_GSYM NType = 0x20 /* global symbol: name,,NO_SECT,type,0 */ N_FNAME NType = 0x22 /* procedure name (f77 kludge): name,,NO_SECT,0,0 */ N_FUN NType = 0x24 /* procedure: name,,n_sect,linenumber,address */ N_STSYM NType = 0x26 /* static symbol: name,,n_sect,type,address */ N_LCSYM NType = 0x28 /* .lcomm symbol: name,,n_sect,type,address */ N_BNSYM NType = 0x2e /* begin nsect sym: 0,,n_sect,0,address */ N_AST NType = 0x32 /* AST file path: name,,NO_SECT,0,0 */ N_OPT NType = 0x3c /* emitted with gcc2_compiled and in gcc source */ N_RSYM NType = 0x40 /* register sym: name,,NO_SECT,type,register */ N_SLINE NType = 0x44 /* src line: 0,,n_sect,linenumber,address */ N_ENSYM NType = 0x4e /* end nsect sym: 0,,n_sect,0,address */ N_SSYM NType = 0x60 /* structure elt: name,,NO_SECT,type,struct_offset */ N_SO NType = 0x64 /* source file name: name,,n_sect,0,address */ N_OSO NType = 0x66 /* object file name: name,,(see below),1,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_LIB NType = 0x68 /* dynamic library file name: name,,NO_SECT,0,0 */ N_LSYM NType = 0x80 /* local sym: name,,NO_SECT,type,offset */ N_BINCL NType = 0x82 /* include file beginning: name,,NO_SECT,0,sum */ N_SOL NType = 0x84 /* #included file name: name,,n_sect,0,address */ N_PARAMS NType = 0x86 /* compiler parameters: name,,NO_SECT,0,0 */ N_VERSION NType = 0x88 /* compiler version: name,,NO_SECT,0,0 */ N_OLEVEL NType = 0x8A /* compiler -O level: name,,NO_SECT,0,0 */ N_PSYM NType = 0xa0 /* parameter: name,,NO_SECT,type,offset */ N_EINCL NType = 0xa2 /* include file end: name,,NO_SECT,0,0 */ N_ENTRY NType = 0xa4 /* alternate entry: name,,n_sect,linenumber,address */ N_LBRAC NType = 0xc0 /* left bracket: 0,,NO_SECT,nesting level,address */ N_EXCL NType = 0xc2 /* deleted include file: name,,NO_SECT,0,sum */ N_RBRAC NType = 0xe0 /* right bracket: 0,,NO_SECT,nesting level,address */ N_BCOMM NType = 0xe2 /* begin common: name,,NO_SECT,0,0 */ N_ECOMM NType = 0xe4 /* end common: name,,n_sect,0,0 */ N_ECOML NType = 0xe8 /* end common (local name): 0,,n_sect,0,address */ N_LENG NType = 0xfe /* second stab entry with length information */ /* * for the berkeley pascal compiler, pc(1): */ N_PC NType = 0x30 /* global pascal symbol: name,,NO_SECT,subtype,line */ )
* Symbolic debugger symbols.
func (NType) IsAbsoluteSym ¶
func (NType) IsAlternateEntry ¶
func (NType) IsAstFilePath ¶
func (NType) IsBeginCommon ¶
func (NType) IsBeginNsectSym ¶
func (NType) IsCompilerOLevel ¶
func (NType) IsCompilerParams ¶
func (NType) IsCompilerVersion ¶
func (NType) IsDebugSym ¶
func (NType) IsDefinedInSection ¶
func (NType) IsDeletedIncludeFile ¶
func (NType) IsEndCommon ¶
func (NType) IsEndCommonLocal ¶
func (NType) IsEndNsectSym ¶
func (NType) IsExternalSym ¶
func (NType) IsGccCompiled ¶
func (NType) IsIncludeFileBegin ¶
func (NType) IsIncludeFileEnd ¶
func (NType) IsIncludedFile ¶
func (NType) IsIndirectSym ¶
func (NType) IsLcommSym ¶
func (NType) IsLeftBracket ¶
func (NType) IsLocalSym ¶
func (NType) IsObjectFile ¶
func (NType) IsParameter ¶
func (NType) IsPascalSymbol ¶
func (NType) IsPreboundUndefinedSym ¶
func (NType) IsPrivateExternalSym ¶
func (NType) IsProcedure ¶
func (NType) IsProcedureName ¶
func (NType) IsRegisterSym ¶
func (NType) IsRightBracket ¶
func (NType) IsSecondStabEntry ¶
func (NType) IsSourceFile ¶
func (NType) IsSourceLine ¶
func (NType) IsStructure ¶
func (NType) IsUndefinedSym ¶
type NoteAddrableBitsV3 ¶
Note commands DataOwner = "addrable bits"
type NoteAddrableBitsV4 ¶
type NoteAllImageInfos ¶
type NoteAllImageInfosImage ¶
type NoteAllImageInfosImage struct { Name string Entry NoteAllImageInfosImageEntry Segments []NoteAllImageInfosSegmentVmaddr }
type NoteAllImageInfosImageEntry ¶
type NoteAllImageInfosImageEntry struct { FilepathOffset uint64 // offset in corefile to c-string of the file path, // UINT64_MAX if unavailable. UUID UUID // uint8_t[16]. should be set to all zeroes if // uuid is unknown. LoadAddress uint64 // UINT64_MAX if unknown. SegAddrsOffset uint64 // offset to the array of struct segment_vmaddr's. SegmentCount uint32 // The number of segments for this binary. Unused uint32 }
type NoteCmd ¶
type NoteCmd struct { LoadCmd // LC_NOTE Len uint32 // sizeof(struct note_command) DataOwner [16]byte // owner name for this LC_NOTE Offset uint64 // file offset of this data Size uint64 // length of data region }
* NoteCmd describe a region of arbitrary data included in a Mach-O * file. Its initial use is to record extra data in MH_CORE files.
type Platform ¶
type Platform uint32
Platform is a macho platform object
const ( Platform_Unknown Platform = 0 // PLATFORM_UNKNOWN Platform_macOS Platform = 1 // PLATFORM_MACOS Platform_iOS Platform = 2 // PLATFORM_IOS Platform_tvOS Platform = 3 // PLATFORM_TVOS Platform_watchOS Platform = 4 // PLATFORM_WATCHOS Platform_bridgeOS Platform = 5 // PLATFORM_BRIDGEOS Platform_macCatalyst Platform = 6 // PLATFORM_MACCATALYST Platform_iOsSimulator Platform = 7 // PLATFORM_IOSSIMULATOR Platform_tvOsSimulator Platform = 8 // PLATFORM_TVOSSIMULATOR Platform_watchOsSimulator Platform = 9 // PLATFORM_WATCHOSSIMULATOR Platform_Driverkit Platform = 10 // PLATFORM_DRIVERKIT Platform_visionOS Platform = 11 // PLATFORM_VISIONOS Platform_visionOsSimulator Platform = 12 // PLATFORM_VISIONOSSIMULATOR Platform_Firmware Platform = 13 // PLATFORM_FIRMWARE Platform_sepOS Platform = 14 // PLATFORM_SEPOS Platform_macOSExclaveCore Platform = 15 // PLATFORM_MACOS_EXCLAVECORE Platform_macOSExclaveKit Platform = 16 // PLATFORM_MACOS_EXCLAVEKIT Platform_iOSExclaveCore Platform = 17 // PLATFORM_IOS_EXCLAVECORE Platform_iOSExclaveKit Platform = 18 // PLATFORM_IOS_EXCLAVEKIT Platform_tvOsExclaveCore Platform = 19 // PLATFORM_TVOS_EXCLAVECORE Platform_tvOsExclaveKit Platform = 20 // PLATFORM_TVOS_EXCLAVEKIT Platform_watchOsExclaveCore Platform = 21 // PLATFORM_WATCHOS_EXCLAVECORE Platform_watchOsExclaveKit Platform = 22 // PLATFORM_WATCHOS_EXCLAVEKIT ANY Platform = 0xFFFFFFFF // PLATFORM_ANY )
func GetPlatformByName ¶
type PrePageCmd ¶
A PrePageCmd is a fixed VM file inclusion (internal use).
type PrebindCksumCmd ¶
type PrebindCksumCmd struct { LoadCmd // LC_PREBIND_CKSUM Len uint32 // sizeof(struct prebind_cksum_command) CheckSum uint32 // the check sum or zero }
* PrebindCksumCmd contains the value of the original check sum for * prebound files or zero. When a prebound file is first created or modified * for other than updating its prebinding information the value of the check sum * is set to zero. When the file has it prebinding re-done and if the value of * the check sum is zero the original check sum is calculated and stored in * cksum field of this load command in the output file. If when the prebinding * is re-done and the cksum field is non-zero it is left unchanged from the * input file.
type PreboundDylibCmd ¶
type PreboundDylibCmd struct { LoadCmd // LC_PREBOUND_DYLIB Len uint32 /* includes strings */ NameOffset uint32 // library's path name NumModules uint32 // number of modules in library LinkedModulesOffset uint32 // bit vector of linked modules }
* PreboundDylibCmd a program (filetype == MH_EXECUTE) that is * prebound to its dynamic libraries has one of these for each library that * the static linker used in prebinding. It contains a bit vector for the * modules in the library. The bits indicate which modules are bound (1) and * which are not (0) from the library. The bit for module 0 is the low bit * of the first byte. So the bit for the Nth module is: * (linked_modules[N/8] >> N%8) & 1
type ReExportDylibCmd ¶
type ReExportDylibCmd DylibCmd // LC_REEXPORT_DYLIB
A ReExportDylibCmd is a Mach-O load and re-export dylib command.
type Rebase ¶
type Reloc ¶
type Reloc struct { Addr uint32 Value uint32 // when Scattered == false && Extern == true, Value is the symbol number. // when Scattered == false && Extern == false, Value is the section number. // when Scattered == true, Value is the value that this reloc refers to. Type uint8 Len uint8 // 0=byte, 1=word, 2=long, 3=quad Pcrel bool Extern bool // valid if Scattered == false Scattered bool }
A Reloc represents a Mach-O relocation.
func (*Reloc) MarshalJSON ¶
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 // total size of this command InitAddress uint64 // address of initialization routine InitModule uint64 // index into the module table that the init routine is defined in Reserved1 uint64 Reserved2 uint64 Reserved3 uint64 Reserved4 uint64 Reserved5 uint64 Reserved6 uint64 }
A Routines64Cmd is a Mach-O 64-bit version of RoutinesCmd
type RoutinesCmd ¶
type RoutinesCmd struct { LoadCmd // LC_ROUTINES Len uint32 // total size of this command InitAddress uint32 // address of initialization routine InitModule uint32 // index into the module table that the init routine is defined in Reserved1 uint32 Reserved2 uint32 Reserved3 uint32 Reserved4 uint32 Reserved5 uint32 Reserved6 uint32 }
* RoutinesCmd contains the address of the dynamic shared library * initialization routine and an index into the module table for the module * that defines the routine. Before any modules are used from the library the * dynamic linker fully binds the module that defines the initialization routine * and then calls it. This gets called before any module initialization * routines (used for C++ static constructors) in the library.
type RpathCmd ¶
type RpathCmd struct { LoadCmd // LC_RPATH Len uint32 // includes string PathOffset uint32 // path to add to run path }
* RpathCmd contains a path which at runtime should be added to * the current run path used to find @rpath prefixed dylibs.
type Section ¶
type Section struct { SectionHeader Relocs []Reloc // Embed ReaderAt for ReadAt method. // Do not embed SectionReader directly // to avoid having Read and Seek. // If a client wants Read and Seek it must use // Open() to avoid fighting over the seek offset // with other clients. io.ReaderAt // contains filtered or unexported fields }
func (*Section) MarshalJSON ¶
func (*Section) Open ¶
func (s *Section) Open() io.ReadSeeker
Open returns a new ReadSeeker reading the Mach-O section.
func (*Section) PutUncompressedData ¶
func (*Section) SetReaders ¶
func (s *Section) SetReaders(r io.ReaderAt, sr *io.SectionReader)
func (*Section) UncompressedSize ¶
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) Attributes ¶
func (f SectionFlag) Attributes() string
func (SectionFlag) AttributesList ¶
func (f SectionFlag) AttributesList() []string
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 SectionHeader ¶
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 */ }
* Segment32 is a 32-bit segment load command indicates that a part of this file is to be * mapped into the task's address space. The size of this segment in memory, * vmsize, maybe equal to or larger than the amount to map from this file, * filesize. The file is mapped starting at fileoff to the beginning of * the segment in memory, vmaddr. The rest of the memory of the segment, * if any, is allocated zero fill on demand. The segment's maximum virtual * memory protection and initial virtual memory protection are specified * by the maxprot and initprot fields. If the segment has sections then the * section structures directly follow the segment command and their size is * reflected in cmdsize.
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 */ }
* Segment64 is a 64-bit segment load command indicates that a part of this file is to be * mapped into a 64-bit task's address space. If the 64-bit segment has * sections then section_64 structures directly follow the 64-bit segment * command and their size is reflected in cmdsize.
type SegmentSplitInfoCmd ¶
type SegmentSplitInfoCmd LinkEditDataCmd // LC_SEGMENT_SPLIT_INFO
A SegmentSplitInfoCmd is a Mach-O code info to split segments command.
type SepCacheSlideCmd ¶
type SepCacheSlideCmd LinkEditDataCmd // LC_SEP_CACHE_SLIDE
type SepSymsegCmd ¶
type SepSymtabCmd ¶
type SepUnknown2Cmd ¶
type SepUnknown2Cmd LinkEditDataCmd // LC_SEP_UNKNOWN_2
type SepUnknown3Cmd ¶
type SepUnknown3Cmd LinkEditDataCmd // LC_SEP_UNKNOWN_3
type SourceVersionCmd ¶
type SourceVersionCmd struct { LoadCmd // LC_SOURCE_VERSION Len uint32 // 16 Version SrcVersion // A.B.C.D.E packed as a24.b10.c10.d10.e10 }
* SourceVersionCmd is an optional load command containing * the version of the sources used to build the binary.
type SplitInfoKind ¶
type SplitInfoKind uint64
const ( DYLD_CACHE_ADJ_V2_FORMAT = 0x7F DYLD_CACHE_ADJ_V2_POINTER_32 SplitInfoKind = 0x01 DYLD_CACHE_ADJ_V2_POINTER_64 SplitInfoKind = 0x02 DYLD_CACHE_ADJ_V2_DELTA_32 SplitInfoKind = 0x03 DYLD_CACHE_ADJ_V2_DELTA_64 SplitInfoKind = 0x04 DYLD_CACHE_ADJ_V2_ARM64_ADRP SplitInfoKind = 0x05 DYLD_CACHE_ADJ_V2_ARM64_OFF12 SplitInfoKind = 0x06 DYLD_CACHE_ADJ_V2_ARM64_BR26 SplitInfoKind = 0x07 DYLD_CACHE_ADJ_V2_ARM_MOVW_MOVT SplitInfoKind = 0x08 DYLD_CACHE_ADJ_V2_ARM_BR24 SplitInfoKind = 0x09 DYLD_CACHE_ADJ_V2_THUMB_MOVW_MOVT SplitInfoKind = 0x0A DYLD_CACHE_ADJ_V2_THUMB_BR22 SplitInfoKind = 0x0B DYLD_CACHE_ADJ_V2_IMAGE_OFF_32 SplitInfoKind = 0x0C DYLD_CACHE_ADJ_V2_THREADED_POINTER_64 SplitInfoKind = 0x0D )
func (SplitInfoKind) String ¶
func (k SplitInfoKind) String() string
type SrcVersion ¶
type SrcVersion uint64
func (SrcVersion) String ¶
func (sv SrcVersion) String() string
type SubClientCmd ¶
type SubClientCmd struct { LoadCmd // LC_SUB_CLIENT Len uint32 /* includes client string */ ClientOffset uint32 /* the client name */ }
* SubClientCmd for dynamically linked shared libraries that are subframework of an umbrella * framework they can allow clients other than the umbrella framework or other * subframeworks in the same umbrella framework. To do this the subframework * is built with "-allowable_client client_name" and an LC_SUB_CLIENT load * command is created for each -allowable_client flag. The client_name is * usually a framework name. It can also be a name used for bundles clients * where the bundle is built with "-client_name client_name".
type SubFrameworkCmd ¶
type SubFrameworkCmd struct { LoadCmd // LC_SUB_FRAMEWORK Len uint32 /* includes umbrella string */ FrameworkOffset uint32 /* the umbrella framework name */ }
* SubFrameworkCmd a dynamically linked shared library may be a subframework of an umbrella * framework. If so it will be linked with "-umbrella umbrella_name" where * Where "umbrella_name" is the name of the umbrella framework. A subframework * can only be linked against by its umbrella framework or other subframeworks * that are part of the same umbrella framework. Otherwise the static link * editor produces an error and states to link against the umbrella framework. * The name of the umbrella framework for subframeworks is recorded in the * following structure.
type SubLibraryCmd ¶
type SubLibraryCmd struct { LoadCmd // LC_SUB_LIBRARY Len uint32 /* includes sub_library string */ LibraryOffset uint32 /* the sub_library name */ }
* SubLibraryCmd a dynamically linked shared library may be a sub_library of another shared * library. If so it will be linked with "-sub_library library_name" where * Where "library_name" is the name of the sub_library shared library. When * staticly linking when -twolevel_namespace is in effect a twolevel namespace * shared library will only cause its subframeworks and those frameworks * listed as sub_umbrella frameworks and libraries listed as sub_libraries to * be implicited linked in. Any other dependent dynamic libraries will not be * linked it when -twolevel_namespace is in effect. The primary library * recorded by the static linker when resolving a symbol in these libraries * will be the umbrella framework (or dynamic library). Zero or more sub_library * shared libraries may be use by an umbrella framework or (or dynamic library). * The name of a sub_library framework is recorded in the following structure. * For example /usr/lib/libobjc_profile.A.dylib would be recorded as "libobjc".
type SubUmbrellaCmd ¶
type SubUmbrellaCmd struct { LoadCmd // LC_SUB_UMBRELLA Len uint32 /* includes sub_umbrella string */ UmbrellaOffset uint32 /* the sub_umbrella framework name */ }
* SubUmbrellaCmd a dynamically linked shared library may be a sub_umbrella of an umbrella * framework. If so it will be linked with "-sub_umbrella umbrella_name" where * Where "umbrella_name" is the name of the sub_umbrella framework. When * staticly linking when -twolevel_namespace is in effect a twolevel namespace * umbrella framework will only cause its subframeworks and those frameworks * listed as sub_umbrella frameworks to be implicited linked in. Any other * dependent dynamic libraries will not be linked it when -twolevel_namespace * is in effect. The primary library recorded by the static linker when * resolving a symbol in these libraries will be the umbrella framework. * Zero or more sub_umbrella frameworks may be use by an umbrella framework. * The name of a sub_umbrella framework is recorded in the following structure.
type SymsegCmd ¶
type SymsegCmd struct { LoadCmd /* LC_SYMSEG */ Len uint32 /* sizeof(struct symseg_command) */ Offset uint32 /* symbol segment offset */ Size uint32 /* symbol segment size in bytes */ }
* SymsegCmd 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 // sizeof(struct symtab_command) Symoff uint32 // symbol table offset Nsyms uint32 // number of symbol table entries Stroff uint32 // string table offset Strsize uint32 // string table size in bytes }
* SymtabCmd contains the offsets and sizes of the link-edit 4.3BSD * "stab" style symbol table information as described in the header files * <nlist.h> and <stab.h>.
type ThreadCmd ¶
type ThreadCmd struct { LoadCmd // LC_THREAD or LC_UNIXTHREAD Len uint32 // total size of this command }
* ThreadCmd contain machine-specific data structures suitable for * use in the thread state primitives. The machine specific data structures * follow the struct thread_command as follows. * Each flavor of machine specific data structure is preceded by an * constant for the flavor of that data structure, an that is the * count of 's of the size of the state data structure and then * the state data structure follows. This triple may be repeated for many * flavors. The constants for the flavors, counts and state data structure * definitions are expected to be in the header file <machine/thread_status.h>. * These machine specific data structures sizes must be multiples of * 4 bytes. The cmdsize reflects the total size of the thread_command * and all of the sizes of the constants for the flavors, counts and state * data structures. * * For executable objects that are unix processes there will be one * thread_command (cmd == LC_UNIXTHREAD) created for it by the link-editor. * This is the same as a LC_THREAD, except that a stack is automatically * created (based on the shell's limit for the stack size). Command arguments * and environment variables are copied onto that stack.
type ThreadFlavor ¶
type ThreadFlavor uint32
type ThreadState ¶
type ThreadState struct { Flavor ThreadFlavor // flavor of thread state Count uint32 // count of 's in thread state Data []byte // thread state for this flavor }
type TlvDescriptor ¶
* Sections of type S_THREAD_LOCAL_VARIABLES contain an array * of tlv_descriptor structures.
type TwolevelHint ¶
type TwolevelHint uint32
* TwolevelHint provide hints to the dynamic link editor where to start * looking for an undefined symbol in a two-level namespace image. The * isub_image field is an index into the sub-images (sub-frameworks and * sub-umbrellas list) that made up the two-level image that the undefined * symbol was found in when it was built by the static link editor. If * isub-image is 0 the the symbol is expected to be defined in library and not * in the sub-images. If isub-image is non-zero it is an index into the array * of sub-images for the umbrella with the first index in the sub-images being * 1. The array of sub-images is the ordered list of sub-images of the umbrella * that would be searched for a symbol that has the umbrella recorded as its * primary library. The table of contents index is an index into the * library's table of contents. This is used as the starting point of the * binary search or a directed linear search.
func (TwolevelHint) MarshalJSON ¶
func (t TwolevelHint) MarshalJSON() ([]byte, error)
func (TwolevelHint) SubImageIndex ¶
func (t TwolevelHint) SubImageIndex() uint8
SubImageIndex index into the sub images
func (TwolevelHint) TableOfContentsIndex ¶
func (t TwolevelHint) TableOfContentsIndex() uint32
TableOfContentsIndex index into the table of contents
type TwolevelHintsCmd ¶
type TwolevelHintsCmd struct { LoadCmd // LC_TWOLEVEL_HINTS Len uint32 // sizeof(struct twolevel_hints_command) Offset uint32 // offset to the hint table NumHints uint32 // number of hints in the hint table }
* TwolevelHintsCmd contains the offset and number of hints in the * two-level namespace lookup hints table.
type UUID ¶
type UUID [16]byte
UUID is a macho uuid object
type UUIDCmd ¶
type UUIDCmd struct { LoadCmd // LC_UUID Len uint32 // sizeof(struct uuid_command) UUID UUID // the 128-bit uuid }
* UUIDCmd contains a single 128-bit unique random number that * identifies an object produced by the static link editor.
type VMAddrConverter ¶
type VMAddrConverter struct { PreferredLoadAddress uint64 Slide int64 ChainedPointerFormat uint16 IsContentRebased bool Converter func(uint64) uint64 VMAddr2Offet func(uint64) (uint64, error) Offet2VMAddr func(uint64) (uint64, error) }
func (*VMAddrConverter) Convert ¶
func (v *VMAddrConverter) Convert(addr uint64) uint64
func (*VMAddrConverter) GetOffset ¶
func (v *VMAddrConverter) GetOffset(address uint64) (uint64, error)
GetOffset returns the file offset for a given virtual address
func (*VMAddrConverter) GetVMAddress ¶
func (v *VMAddrConverter) GetVMAddress(offset uint64) (uint64, error)
GetVMAddress returns the virtal address for a given file offset
type VersionMinCmd ¶
type VersionMinCmd struct { LoadCmd /* LC_VERSION_MIN_MACOSX or LC_VERSION_MIN_IPHONEOS or LC_VERSION_MIN_WATCHOS or LC_VERSION_MIN_TVOS */ Len uint32 // sizeof(struct min_version_command) Version Version // X.Y.Z is encoded in nibbles xxxx.yy.zz Sdk Version // X.Y.Z is encoded in nibbles xxxx.yy.zz }
* VersionMinCmd contains the min OS version on which this * binary was built to run.
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 WriteAtBuffer ¶
type WriteAtBuffer struct { // GrowthCoeff defines the growth rate of the internal buffer. By // default, the growth rate is 1, where expanding the internal // buffer will allocate only enough capacity to fit the new expected // length. GrowthCoeff float64 // contains filtered or unexported fields }
A WriteAtBuffer provides a in memory buffer supporting the io.WriterAt interface Can be used with the s3manager.Downloader to download content to a buffer in memory. Safe to use concurrently.
func NewWriteAtBuffer ¶
func NewWriteAtBuffer(buf []byte) *WriteAtBuffer
NewWriteAtBuffer creates a WriteAtBuffer with an internal buffer provided by buf.
func (*WriteAtBuffer) Bytes ¶
func (b *WriteAtBuffer) Bytes() []byte
Bytes returns a slice of bytes written to the buffer.
func (*WriteAtBuffer) WriteAt ¶
func (b *WriteAtBuffer) WriteAt(p []byte, pos int64) (n int, err error)
WriteAt writes a slice of bytes to a buffer starting at the position provided The number of bytes written will be returned, or error. Can overwrite previous written slices if the write ats overlap.
type X86ThreadFlavor ¶
type X86ThreadFlavor ThreadFlavor
func (X86ThreadFlavor) String ¶
func (i X86ThreadFlavor) String() string