Imports #
"bytes"
"cmd/internal/bio"
"cmd/internal/objabi"
"cmd/internal/sys"
"cmd/link/internal/loader"
"cmd/link/internal/sym"
"encoding/binary"
"fmt"
"bytes"
"cmd/internal/bio"
"cmd/internal/objabi"
"cmd/internal/sys"
"cmd/link/internal/loader"
"cmd/link/internal/sym"
"encoding/binary"
"fmt"
const LdMachoCmdDysymtab = 11
const LdMachoCmdSegment = 1
const LdMachoCmdSegment64 = 25
const LdMachoCmdSymseg = 3
const LdMachoCmdSymtab = 2
const LdMachoCmdThread = 4
const LdMachoCpu386 = 7
const LdMachoCpu68000 = 6
const LdMachoCpu860 = 15
const LdMachoCpu88000 = 13
const LdMachoCpu98000 = 10
const LdMachoCpuAlpha = 16
const LdMachoCpuAmd64 = *ast.BinaryExpr
const LdMachoCpuArm = 12
const LdMachoCpuArm64 = *ast.BinaryExpr
const LdMachoCpuHppa = 11
const LdMachoCpuMips = 8
const LdMachoCpuPower = 18
const LdMachoCpuSparc = 14
const LdMachoCpuVax = 1
const LdMachoFileCore = 4
const LdMachoFileExecutable = 2
const LdMachoFileFvmlib = 3
const LdMachoFileObject = 1
const LdMachoFilePreload = 5
TODO(crawshaw): de-duplicate these symbols with cmd/link/internal/ld
const MACHO_ARM64_RELOC_ADDEND = 10
TODO(crawshaw): de-duplicate these symbols with cmd/link/internal/ld
const MACHO_X86_64_RELOC_SIGNED = 1
TODO(crawshaw): de-duplicate these symbols with cmd/link/internal/ld
const MACHO_X86_64_RELOC_UNSIGNED = 0
ldMachoSym.type_
const N_EXT = 0x01
ldMachoSym.type_
const N_STAB = 0xe0
ldMachoSym.type_
const N_TYPE = 0x1e
ldMachoSym.desc
const N_WEAK_DEF = 0x80
ldMachoSym.desc
const N_WEAK_REF = 0x40
type ldMachoCmd struct {
type_ int
off uint32
size uint32
seg ldMachoSeg
sym ldMachoSymtab
dsym ldMachoDysymtab
}
type ldMachoDysymtab struct {
ilocalsym uint32
nlocalsym uint32
iextdefsym uint32
nextdefsym uint32
iundefsym uint32
nundefsym uint32
tocoff uint32
ntoc uint32
modtaboff uint32
nmodtab uint32
extrefsymoff uint32
nextrefsyms uint32
indirectsymoff uint32
nindirectsyms uint32
extreloff uint32
nextrel uint32
locreloff uint32
nlocrel uint32
indir []uint32
}
type ldMachoObj struct {
f *bio.Reader
base int64
length int64
is64 bool
name string
e binary.ByteOrder
cputype uint
subcputype uint
filetype uint32
flags uint32
cmd []ldMachoCmd
ncmd uint
}
type ldMachoRel struct {
addr uint32
symnum uint32
pcrel uint8
length uint8
extrn uint8
type_ uint8
scattered uint8
value uint32
}
type ldMachoSect struct {
name string
segname string
addr uint64
size uint64
off uint32
align uint32
reloff uint32
nreloc uint32
flags uint32
res1 uint32
res2 uint32
sym loader.Sym
rel []ldMachoRel
}
type ldMachoSeg struct {
name string
vmaddr uint64
vmsize uint64
fileoff uint32
filesz uint32
maxprot uint32
initprot uint32
nsect uint32
flags uint32
sect []ldMachoSect
}
type ldMachoSym struct {
name string
type_ uint8
sectnum uint8
desc uint16
kind int8
value uint64
sym loader.Sym
}
type ldMachoSymtab struct {
symoff uint32
nsym uint32
stroff uint32
strsize uint32
str []byte
sym []ldMachoSym
}
Load the Mach-O file pn from f. Symbols are written into syms, and a slice of the text symbols is returned.
func Load(l *loader.Loader, arch *sys.Arch, localSymVersion int, f *bio.Reader, pkg string, length int64, pn string) (textp []loader.Sym, err error)
func cstring(x []byte) string
func macholoaddsym(m *ldMachoObj, d *ldMachoDysymtab) int
func macholoadrel(m *ldMachoObj, sect *ldMachoSect) int
func macholoadsym(m *ldMachoObj, symtab *ldMachoSymtab) int
func unpackcmd(p []byte, m *ldMachoObj, c *ldMachoCmd, type_ uint, sz uint) int
Generated with Arrow