lmacho

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// skip
	CpuTypeX86    macho.Cpu = 7
	CpuTypeI386   macho.Cpu = CpuTypeX86
	CpuTypeX86_64 macho.Cpu = CpuTypeI386 | cpuArch64
	// skip
	CpuTypeArm      macho.Cpu = 12
	CpuTypeArm64    macho.Cpu = CpuTypeArm | cpuArch64
	CpuTypeArm64_32 macho.Cpu = CpuTypeArm | cpuArch64_32
	CpuTypePpc      macho.Cpu = 18
	CpuTypePpc64    macho.Cpu = CpuTypePpc | 64
)
View Source
const (
	SubCpuTypeX86All    uint32 = 3
	SubCpuTypeX86_64All uint32 = 3
	SubCpuTypeX86Arch1  uint32 = 4
	SubCpuTypeX86_64H   uint32 = 8
)
View Source
const (
	SubCpuTypeArmAll uint32 = 0
	SubCpuTypeArmV4T uint32 = 5
	SubCpuTypeArmV6  uint32 = 6
	// skip
	SubCpuTypeArmV7  uint32 = 9
	SubCpuTypeArmV7F uint32 = 10
	SubCpuTypeArmV7S uint32 = 11
	SubCpuTypeArmV7K uint32 = 12
	// skip
	SubCpuTypeArmV6M  uint32 = 14
	SubCpuTypeArmV7M  uint32 = 15
	SubCpuTypeArmV7EM uint32 = 16
	SubCpuTypeArmV8M  uint32 = 17
)
View Source
const (
	SubCpuTypeArm64All uint32 = 0
	SubCpuTypeArm64V8  uint32 = 1
	SubCpuTypeArm64E   uint32 = 2
)
View Source
const MagicFat64 = macho.MagicFat + 1
View Source
const MaskSubCpuType uint32 = 0xff000000
View Source
const (
	SubCpuTypeArm64_32All uint32 = 0
)

Variables

View Source
var SortFunc = sort.Slice

Note mock using qsort

Functions

func CpuNames

func CpuNames() []string

func GuessAlignBit

func GuessAlignBit(addr uint64, min, max uint32) uint32

func IsSupportedCpu

func IsSupportedCpu(v string) bool

func SegmentAlignBit

func SegmentAlignBit(f *macho.File) uint32

func ToCpu

func ToCpu(v string) (cpu macho.Cpu, sub uint32, ok bool)

func ToCpuString

func ToCpuString(cpu macho.Cpu, subCpu uint32) string

func ToCpuValues

func ToCpuValues(c macho.Cpu, s uint32) (string, string)

func ValidateFatArches

func ValidateFatArches(arches []FatArch) error

Types

type FatArch

type FatArch struct {
	FatArchHeader
	FileHeader *macho.FileHeader
	Name       string
	// contains filtered or unexported fields
}

FatArchHeader is a header for a Macho-0 32 bit or 64 bit

func NewFatArch

func NewFatArch(name string) (*FatArch, error)

func (*FatArch) Open

func (fa *FatArch) Open() (*File, error)

type FatArchHeader

type FatArchHeader struct {
	Cpu    macho.Cpu
	SubCpu uint32
	Offset uint64
	Size   uint64
	Align  uint32
}

FatArchHeader is a header for a Macho-0 32 bit or 64 bit

type FatFile

type FatFile struct {
	Magic        uint32
	Arches       []FatArch
	HiddenArches []FatArch
}

FatFile presets an universal file for 32 bit or 64 bit

func NewFatFileFromArches added in v0.2.1

func NewFatFileFromArches(farches []FatArch, cfg *FatFileConfig) *FatFile

func OpenFat

func OpenFat(name string) (*FatFile, error)

func (*FatFile) AllArches

func (f *FatFile) AllArches() []FatArch

func (*FatFile) Create

func (f *FatFile) Create(out io.Writer) error

type FatFileConfig

type FatFileConfig struct {
	HideArm64 bool
	Fat64     bool
}

type FatHeader

type FatHeader struct {
	Magic uint32
	NArch uint32
}

FatHeader is a header for a Macho-0 32 bit or 64 bit see /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/mach-o/fat.h

type File

type File struct {
	// contains filtered or unexported fields
}

func (*File) Close

func (f *File) Close() error

func (*File) Read

func (f *File) Read(p []byte) (int, error)

func (*File) ReadAt

func (f *File) ReadAt(p []byte, off int64) (int, error)

Jump to

Keyboard shortcuts

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