lmacho

package
v0.8.6 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 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 MagicFat64 = macho.MagicFat + 1

Variables

This section is empty.

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 ToCpuString

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

func ToCpuValues

func ToCpuValues(c macho.Cpu, s SubCpu) (cpu string, sub string)

Types

type FatArch

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

FatArch has architecture information to create a fat file.

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 SubCpu
	Offset uint64
	Size   uint64
	Align  uint32
}

FatArchHeader presets an architecture header for a Macho-0 32 bit and 64 bit

type FatFile

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

FatFile presets an universal file

func NewFatFile added in v0.6.0

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

func NewFatFileFromArches added in v0.2.1

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

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 presets a header for a fat 32 bit and fat 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)

type FormatError added in v0.6.0

type FormatError struct {
	Err error
}

func (*FormatError) Error added in v0.6.0

func (e *FormatError) Error() string

type SubCpu added in v0.5.0

type SubCpu = uint32
const (
	SubCpuTypeX86All    SubCpu = 3
	SubCpuTypeX86_64All SubCpu = 3
	SubCpuTypeX86Arch1  SubCpu = 4
	SubCpuTypeX86_64H   SubCpu = 8
)
const (
	SubCpuTypeArmAll SubCpu = 0
	SubCpuTypeArmV4T SubCpu = 5
	SubCpuTypeArmV6  SubCpu = 6
	// skip
	SubCpuTypeArmV7  SubCpu = 9
	SubCpuTypeArmV7F SubCpu = 10
	SubCpuTypeArmV7S SubCpu = 11
	SubCpuTypeArmV7K SubCpu = 12
	// skip
	SubCpuTypeArmV6M  SubCpu = 14
	SubCpuTypeArmV7M  SubCpu = 15
	SubCpuTypeArmV7EM SubCpu = 16
	SubCpuTypeArmV8M  SubCpu = 17
)
const (
	SubCpuTypeArm64All SubCpu = 0
	SubCpuTypeArm64V8  SubCpu = 1
	SubCpuTypeArm64E   SubCpu = 2
)
const MaskSubCpuType SubCpu = 0xff000000
const (
	SubCpuTypeArm64_32V8 SubCpu = 1
)

func ToCpu

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

Jump to

Keyboard shortcuts

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