Go: cmd/link/internal/loadmacho Index | Files

package loadmacho

import "cmd/link/internal/loadmacho"

Package loadmacho implements a Mach-O file reader.

Index

Package Files

ldmacho.go

Constants

const (
    N_EXT  = 0x01
    N_TYPE = 0x1e
    N_STAB = 0xe0
)

Derived from Plan 9 from User Space's src/libmach/elf.h, elf.c http://code.swtch.com/plan9port/src/tip/src/libmach/

Copyright © 2004 Russ Cox.
Portions Copyright © 2008-2010 Google Inc.
Portions Copyright © 2010 The Go Authors.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

const (
    MACHO_X86_64_RELOC_UNSIGNED = 0
    MACHO_X86_64_RELOC_SIGNED   = 1
    MACHO_FAKE_GOTPCREL         = 100
)

TODO(crawshaw): de-duplicate these symbols with cmd/internal/ld

const (
    LdMachoCpuVax         = 1
    LdMachoCpu68000       = 6
    LdMachoCpu386         = 7
    LdMachoCpuAmd64       = 0x1000007
    LdMachoCpuMips        = 8
    LdMachoCpu98000       = 10
    LdMachoCpuHppa        = 11
    LdMachoCpuArm         = 12
    LdMachoCpu88000       = 13
    LdMachoCpuSparc       = 14
    LdMachoCpu860         = 15
    LdMachoCpuAlpha       = 16
    LdMachoCpuPower       = 18
    LdMachoCmdSegment     = 1
    LdMachoCmdSymtab      = 2
    LdMachoCmdSymseg      = 3
    LdMachoCmdThread      = 4
    LdMachoCmdDysymtab    = 11
    LdMachoCmdSegment64   = 25
    LdMachoFileObject     = 1
    LdMachoFileExecutable = 2
    LdMachoFileFvmlib     = 3
    LdMachoFileCore       = 4
    LdMachoFilePreload    = 5
)

func Load Uses

func Load(arch *sys.Arch, syms *sym.Symbols, f *bio.Reader, pkg string, length int64, pn string) (textp []*sym.Symbol, err error)

Load loads the Mach-O file pn from f. Symbols are written into syms, and a slice of the text symbols is returned.

Package loadmacho imports 9 packages (graph) and is imported by 2 packages. Updated 2019-05-11. Refresh now. Tools for package owners.