package macho

Import Path
	debug/macho (on golang.org and go.dev)

Dependency Relation
	imports 9 packages, and imported by 0 packages

Involved Source Files
	    fat.go
	d-> file.go
	    macho.go
	    reloctype.go
	    reloctype_string.go

Exported Type Names

type Cpu uint32 A Cpu is a Mach-O cpu type. (T) GoString() string (T) String() string T : expvar.Var T : fmt.GoStringer T : fmt.Stringer const Cpu386 const CpuAmd64 const CpuArm const CpuArm64 const CpuPpc const CpuPpc64
type Dylib (struct) A Dylib represents a Mach-O load dynamic library command. CompatVersion uint32 CurrentVersion uint32 LoadBytes LoadBytes Name string Time uint32 (T) Raw() []byte T : Load
type DylibCmd (struct) A DylibCmd is a Mach-O load dynamic library command. Cmd LoadCmd CompatVersion uint32 CurrentVersion uint32 Len uint32 Name uint32 Time uint32
type FatArchHeader (struct) A FatArchHeader represents a fat header for a specific image architecture. Align uint32 Cpu Cpu Offset uint32 Size uint32 SubCpu uint32
type FatFile (struct) A FatFile is a Mach-O universal binary that contains at least one architecture. Arches []FatArch Magic uint32 (*T) Close() error *T : io.Closer func NewFatFile(r io.ReaderAt) (*FatFile, error) func OpenFat(name string) (*FatFile, error)
type File (struct) A File represents an open Mach-O file. ByteOrder binary.ByteOrder Dysymtab *Dysymtab FileHeader FileHeader FileHeader.Cmdsz uint32 FileHeader.Cpu Cpu FileHeader.Flags uint32 FileHeader.Magic uint32 FileHeader.Ncmd uint32 FileHeader.SubCpu uint32 FileHeader.Type Type Loads []Load Sections []*Section Symtab *Symtab (*T) Close() error (*T) DWARF() (*dwarf.Data, error) (*T) ImportedLibraries() ([]string, error) (*T) ImportedSymbols() ([]string, error) (*T) Section(name string) *Section (*T) Segment(name string) *Segment *T : io.Closer func NewFile(r io.ReaderAt) (*File, error) func Open(name string) (*File, error)
type FileHeader (struct) A FileHeader represents a Mach-O file header. Cmdsz uint32 Cpu Cpu Flags uint32 Magic uint32 Ncmd uint32 SubCpu uint32 Type Type
type FormatError (struct) FormatError is returned by some operations if the data does not have the correct format for an object file. (*T) Error() string *T : error var ErrNotFat *FormatError
type Load (interface) A Load represents any Mach-O load command. (T) Raw() []byte Dylib Dysymtab LoadBytes Rpath Segment Symtab
type LoadBytes ([]) A LoadBytes is the uninterpreted bytes of a Mach-O load command. (T) Raw() []byte T : Load
type LoadCmd uint32 A LoadCmd is a Mach-O load command. (T) GoString() string (T) String() string T : expvar.Var T : fmt.GoStringer T : fmt.Stringer const LoadCmdDylib const LoadCmdDylinker const LoadCmdDysymtab const LoadCmdRpath const LoadCmdSegment const LoadCmdSegment64 const LoadCmdSymtab const LoadCmdThread const LoadCmdUnixThread
type Nlist32 (struct) An Nlist32 is a Mach-O 32-bit symbol table entry. Desc uint16 Name uint32 Sect uint8 Type uint8 Value uint32
type Nlist64 (struct) An Nlist64 is a Mach-O 64-bit symbol table entry. Desc uint16 Name uint32 Sect uint8 Type uint8 Value uint64
type Regs386 (struct) Regs386 is the Mach-O 386 register structure. AX uint32 BP uint32 BX uint32 CS uint32 CX uint32 DI uint32 DS uint32 DX uint32 ES uint32 FLAGS uint32 FS uint32 GS uint32 IP uint32 SI uint32 SP uint32 SS uint32
type RegsAMD64 (struct) RegsAMD64 is the Mach-O AMD64 register structure. AX uint64 BP uint64 BX uint64 CS uint64 CX uint64 DI uint64 DX uint64 FLAGS uint64 FS uint64 GS uint64 IP uint64 R10 uint64 R11 uint64 R12 uint64 R13 uint64 R14 uint64 R15 uint64 R8 uint64 R9 uint64 SI uint64 SP uint64
type Reloc (struct) A Reloc represents a Mach-O relocation. Addr uint32 Extern bool Len uint8 Pcrel bool Scattered bool Type uint8 Value uint32
type RelocTypeARM int (T) GoString() string (T) String() string T : expvar.Var T : fmt.GoStringer T : fmt.Stringer const ARM_RELOC_BR24 const ARM_RELOC_HALF const ARM_RELOC_HALF_SECTDIFF const ARM_RELOC_LOCAL_SECTDIFF const ARM_RELOC_PAIR const ARM_RELOC_PB_LA_PTR const ARM_RELOC_SECTDIFF const ARM_RELOC_VANILLA const ARM_THUMB_32BIT_BRANCH const ARM_THUMB_RELOC_BR22
type RelocTypeGeneric int (T) GoString() string (T) String() string T : expvar.Var T : fmt.GoStringer T : fmt.Stringer const GENERIC_RELOC_LOCAL_SECTDIFF const GENERIC_RELOC_PAIR const GENERIC_RELOC_PB_LA_PTR const GENERIC_RELOC_SECTDIFF const GENERIC_RELOC_TLV const GENERIC_RELOC_VANILLA
type RelocTypeX86_64 int (T) GoString() string (T) String() string T : expvar.Var T : fmt.GoStringer T : fmt.Stringer const X86_64_RELOC_BRANCH const X86_64_RELOC_GOT const X86_64_RELOC_GOT_LOAD const X86_64_RELOC_SIGNED const X86_64_RELOC_SIGNED_1 const X86_64_RELOC_SIGNED_2 const X86_64_RELOC_SIGNED_4 const X86_64_RELOC_SUBTRACTOR const X86_64_RELOC_TLV const X86_64_RELOC_UNSIGNED
type Rpath (struct) A Rpath represents a Mach-O rpath command. LoadBytes LoadBytes Path string (T) Raw() []byte T : Load
type RpathCmd (struct) A RpathCmd is a Mach-O rpath command. Cmd LoadCmd Len uint32 Path uint32
type Section32 (struct) A Section32 is a 32-bit Mach-O section header. Addr uint32 Align uint32 Flags uint32 Name [16]byte Nreloc uint32 Offset uint32 Reloff uint32 Reserve1 uint32 Reserve2 uint32 Seg [16]byte Size uint32
type Section64 (struct) A Section64 is a 64-bit Mach-O section header. Addr uint64 Align uint32 Flags uint32 Name [16]byte Nreloc uint32 Offset uint32 Reloff uint32 Reserve1 uint32 Reserve2 uint32 Reserve3 uint32 Seg [16]byte Size uint64
type Segment (struct) A Segment represents a Mach-O 32-bit or 64-bit load segment command. LoadBytes LoadBytes ReaderAt io.ReaderAt SegmentHeader SegmentHeader SegmentHeader.Addr uint64 SegmentHeader.Cmd LoadCmd SegmentHeader.Filesz uint64 SegmentHeader.Flag uint32 SegmentHeader.Len uint32 SegmentHeader.Maxprot uint32 SegmentHeader.Memsz uint64 SegmentHeader.Name string SegmentHeader.Nsect uint32 SegmentHeader.Offset uint64 SegmentHeader.Prot uint32 (*T) Data() ([]byte, error) (*T) Open() io.ReadSeeker (T) Raw() []byte (T) ReadAt(p []byte, off int64) (n int, err error) T : Load T : io.ReaderAt func (*File).Segment(name string) *Segment
type Segment32 (struct) A Segment32 is a 32-bit Mach-O segment load command. Addr uint32 Cmd LoadCmd Filesz uint32 Flag uint32 Len uint32 Maxprot uint32 Memsz uint32 Name [16]byte Nsect uint32 Offset uint32 Prot uint32
type Segment64 (struct) A Segment64 is a 64-bit Mach-O segment load command. Addr uint64 Cmd LoadCmd Filesz uint64 Flag uint32 Len uint32 Maxprot uint32 Memsz uint64 Name [16]byte Nsect uint32 Offset uint64 Prot uint32
type SegmentHeader (struct) A SegmentHeader is the header for a Mach-O 32-bit or 64-bit load segment command. Addr uint64 Cmd LoadCmd Filesz uint64 Flag uint32 Len uint32 Maxprot uint32 Memsz uint64 Name string Nsect uint32 Offset uint64 Prot uint32
type Symbol (struct) A Symbol is a Mach-O 32-bit or 64-bit symbol table entry. Desc uint16 Name string Sect uint8 Type uint8 Value uint64
type Symtab (struct) A Symtab represents a Mach-O symbol table command. LoadBytes LoadBytes Syms []Symbol SymtabCmd SymtabCmd SymtabCmd.Cmd LoadCmd SymtabCmd.Len uint32 SymtabCmd.Nsyms uint32 SymtabCmd.Stroff uint32 SymtabCmd.Strsize uint32 SymtabCmd.Symoff uint32 (T) Raw() []byte T : Load
type SymtabCmd (struct) A SymtabCmd is a Mach-O symbol table command. Cmd LoadCmd Len uint32 Nsyms uint32 Stroff uint32 Strsize uint32 Symoff uint32
type Thread (struct) A Thread is a Mach-O thread state command. Cmd LoadCmd Data []uint32 Len uint32 Type uint32
type Type uint32 A Type is the Mach-O file type, e.g. an object file, executable, or dynamic library. (T) GoString() string (T) String() string T : expvar.Var T : fmt.GoStringer T : fmt.Stringer const TypeBundle const TypeDylib const TypeExec const TypeObj
Exported Values
const Cpu386 Cpu = 7
const CpuAmd64 Cpu = 16777223
const CpuArm Cpu = 12
const CpuArm64 Cpu = 16777228
const CpuPpc Cpu = 18
const CpuPpc64 Cpu = 16777234
var ErrNotFat *FormatError ErrNotFat is returned from NewFatFile or OpenFat when the file is not a universal binary but may be a thin binary, based on its magic number.
const FlagAllModsBound uint32 = 4096
const FlagAppExtensionSafe uint32 = 33554432
const FlagBindsToWeak uint32 = 65536
const FlagCanonical uint32 = 16384
const FlagForceFlat uint32 = 256
const FlagHasTLVDescriptors uint32 = 8388608
const FlagLazyInit uint32 = 64
const FlagNoHeapExecution uint32 = 16777216
const FlagNoMultiDefs uint32 = 512
const FlagNoUndefs uint32 = 1
const FlagPIE uint32 = 2097152
const FlagPrebindable uint32 = 2048
const FlagPrebound uint32 = 16
const FlagRootSafe uint32 = 262144
const FlagSetuidSafe uint32 = 524288
const FlagSplitSegs uint32 = 32
const FlagTwoLevel uint32 = 128
const FlagWeakDefines uint32 = 32768
const LoadCmdDylib LoadCmd = 12 // load dylib command
const LoadCmdDylinker LoadCmd = 15 // id dylinker command (not load dylinker command)
const LoadCmdRpath LoadCmd = 2147483676
const LoadCmdUnixThread LoadCmd = 5 // thread+stack
const Magic32 uint32 = 4277009102
const Magic64 uint32 = 4277009103
const MagicFat uint32 = 3405691582
func NewFatFile(r io.ReaderAt) (*FatFile, error) NewFatFile creates a new FatFile for accessing all the Mach-O images in a universal binary. The Mach-O binary is expected to start at position 0 in the ReaderAt.
func NewFile(r io.ReaderAt) (*File, error) NewFile creates a new File for accessing a Mach-O binary in an underlying reader. The Mach-O binary is expected to start at position 0 in the ReaderAt.
func Open(name string) (*File, error) Open opens the named file using os.Open and prepares it for use as a Mach-O binary.
func OpenFat(name string) (*FatFile, error) OpenFat opens the named file using os.Open and prepares it for use as a Mach-O universal binary.
const TypeBundle Type = 8
const TypeDylib Type = 6
const TypeExec Type = 2
const TypeObj Type = 1