Documentation ¶
Index ¶
- Constants
- Variables
- func Addaddr(ctxt *Link, s *Symbol, t *Symbol) int64
- func Addaddrplus(ctxt *Link, s *Symbol, t *Symbol, add int64) int64
- func Addbytes(s *Symbol, bytes []byte) int64
- func Adddynsym(ctxt *Link, s *Symbol)
- func Addpcrelplus(ctxt *Link, s *Symbol, t *Symbol, add int64) int64
- func Addstring(s *Symbol, str string) int64
- func Adduint16(ctxt *Link, s *Symbol, v uint16) int64
- func Adduint32(ctxt *Link, s *Symbol, v uint32) int64
- func Adduint64(ctxt *Link, s *Symbol, v uint64) int64
- func Adduint8(ctxt *Link, s *Symbol, v uint8) int64
- func Append16b(b []byte, v uint16) []byte
- func Append16l(b []byte, v uint16) []byte
- func Append32b(b []byte, v uint32) []byte
- func Append32l(b []byte, v uint32) []byte
- func Append64b(b []byte, v uint64) []byte
- func Append64l(b []byte, v uint64) []byte
- func Asmbelf(ctxt *Link, symo int64)
- func Asmbelfsetup()
- func Asmbmacho(ctxt *Link)
- func Asmbpe(ctxt *Link)
- func Asmelfsym(ctxt *Link)
- func Asmplan9sym(ctxt *Link)
- func AtExit(f func())
- func Be16(b []byte) uint16
- func Be32(b []byte) uint32
- func Cflush()
- func Codeblk(ctxt *Link, addr int64, size int64)
- func CodeblkPad(ctxt *Link, addr int64, size int64, pad []byte)
- func Cput(c uint8)
- func Cseek(p int64)
- func Cwrite(p []byte)
- func Cwritestring(s string)
- func Datblk(ctxt *Link, addr int64, size int64)
- func Domacholink(ctxt *Link) int64
- func Dwarfblk(ctxt *Link, addr int64, size int64)
- func ELF32_R_INFO(sym uint32, type_ uint32) uint32
- func ELF32_R_SYM(info uint32) uint32
- func ELF32_R_TYPE(info uint32) uint32
- func ELF32_ST_BIND(info uint8) uint8
- func ELF32_ST_INFO(bind uint8, type_ uint8) uint8
- func ELF32_ST_TYPE(info uint8) uint8
- func ELF32_ST_VISIBILITY(oth uint8) uint8
- func ELF64_R_INFO(sym uint32, type_ uint32) uint64
- func ELF64_R_SYM(info uint64) uint32
- func ELF64_R_TYPE(info uint64) uint32
- func ELF64_ST_BIND(info uint8) uint8
- func ELF64_ST_INFO(bind uint8, type_ uint8) uint8
- func ELF64_ST_TYPE(info uint8) uint8
- func ELF64_ST_VISIBILITY(oth uint8) uint8
- func Elfadddynsym(ctxt *Link, s *Symbol)
- func Elfemitreloc(ctxt *Link)
- func Elfinit(ctxt *Link)
- func Elfwritedynent(ctxt *Link, s *Symbol, tag int, val uint64)
- func Elfwritedynentsymplus(ctxt *Link, s *Symbol, tag int, t *Symbol, add int64)
- func Entryvalue(ctxt *Link) int64
- func Errorf(s *Symbol, format string, args ...interface{})
- func Exit(code int)
- func Exitf(format string, a ...interface{})
- func Le16(b []byte) uint16
- func Le32(b []byte) uint32
- func Le64(b []byte) uint64
- func Lflag(ctxt *Link, arg string)
- func LoadObjFile(ctxt *Link, f *bio.Reader, lib *Library, length int64, pn string)
- func Lputb(l uint32)
- func Lputl(l uint32)
- func Machoadddynlib(lib string)
- func Machoemitreloc(ctxt *Link)
- func Machoinit()
- func Main()
- func Peinit(ctxt *Link)
- func Rnd(v int64, r int64) int64
- func Symaddr(s *Symbol) int64
- func Symgrow(s *Symbol, siz int64)
- func UseRelro() bool
- func Vputb(v uint64)
- func Vputl(v uint64)
- func Wputb(w uint16)
- func Wputl(w uint16)
- type ArHdr
- type Arch
- type Attribute
- func (a Attribute) CgoExport() bool
- func (a Attribute) CgoExportDynamic() bool
- func (a Attribute) CgoExportStatic() bool
- func (a Attribute) DuplicateOK() bool
- func (a Attribute) External() bool
- func (a Attribute) Hidden() bool
- func (a Attribute) Local() bool
- func (a Attribute) MakeTypelink() bool
- func (a Attribute) NoSplit() bool
- func (a Attribute) OnList() bool
- func (a Attribute) Reachable() bool
- func (a Attribute) ReflectMethod() bool
- func (a *Attribute) Set(flag Attribute, value bool)
- func (a Attribute) Special() bool
- func (a Attribute) StackCheck() bool
- type Auto
- type BuildMode
- type Dll
- type ElfEhdr
- type ElfHdrBytes
- type ElfHdrBytes64
- type ElfObj
- type ElfPhdr
- type ElfProgBytes
- type ElfProgBytes64
- type ElfSect
- type ElfSectBytes
- type ElfSectBytes64
- type ElfShdr
- type ElfSym
- type ElfSymBytes
- type ElfSymBytes64
- type Elfaux
- type Elflib
- type Elfstring
- type FuncInfo
- type GCProg
- type Hostobj
- type IMAGE_DATA_DIRECTORY
- type IMAGE_EXPORT_DIRECTORY
- type IMAGE_FILE_HEADER
- type IMAGE_IMPORT_DESCRIPTOR
- type IMAGE_OPTIONAL_HEADER
- type IMAGE_SECTION_HEADER
- type Imp
- type Library
- type Link
- type LinkMode
- type MachoHdr
- type MachoLoad
- type MachoSect
- type MachoSeg
- type PE64_IMAGE_OPTIONAL_HEADER
- type Pcdata
- type Pciter
- type Pkg
- type Reloc
- type RelocVariant
- type Rpath
- type Section
- type Segment
- type Shlib
- type Symbol
- type SymbolType
- type Symbols
Constants ¶
const ( SARMAG = 8 SAR_HDR = 16 + 44 )
const ( MaxKeySize = 128 MaxValSize = 128 BucketSize = 8 )
synthesizemaptypes is way too closely married to runtime/hashmap.c
const ( LINE_BASE = -4 LINE_RANGE = 10 PC_RANGE = (255 - OPCODE_BASE) / LINE_RANGE OPCODE_BASE = 10 )
* Generate a sequence of opcodes that is as short as possible. * See section 6.2.5
const ( EI_MAG0 = 0 EI_MAG1 = 1 EI_MAG2 = 2 EI_MAG3 = 3 EI_CLASS = 4 EI_DATA = 5 EI_VERSION = 6 EI_OSABI = 7 EI_ABIVERSION = 8 OLD_EI_BRAND = 8 EI_PAD = 9 EI_NIDENT = 16 ELFMAG0 = 0x7f ELFMAG1 = 'E' ELFMAG2 = 'L' ELFMAG3 = 'F' SELFMAG = 4 EV_NONE = 0 EV_CURRENT = 1 ELFCLASSNONE = 0 ELFCLASS32 = 1 ELFCLASS64 = 2 ELFDATANONE = 0 ELFDATA2LSB = 1 ELFDATA2MSB = 2 ELFOSABI_NONE = 0 ELFOSABI_HPUX = 1 ELFOSABI_NETBSD = 2 ELFOSABI_LINUX = 3 ELFOSABI_HURD = 4 ELFOSABI_86OPEN = 5 ELFOSABI_SOLARIS = 6 ELFOSABI_AIX = 7 ELFOSABI_IRIX = 8 ELFOSABI_FREEBSD = 9 ELFOSABI_TRU64 = 10 ELFOSABI_MODESTO = 11 ELFOSABI_OPENBSD = 12 ELFOSABI_OPENVMS = 13 ELFOSABI_NSK = 14 ELFOSABI_ARM = 97 ELFOSABI_STANDALONE = 255 ELFOSABI_SYSV = ELFOSABI_NONE ELFOSABI_MONTEREY = ELFOSABI_AIX ET_NONE = 0 ET_REL = 1 ET_EXEC = 2 ET_DYN = 3 ET_CORE = 4 ET_LOOS = 0xfe00 ET_HIOS = 0xfeff ET_LOPROC = 0xff00 ET_HIPROC = 0xffff EM_NONE = 0 EM_M32 = 1 EM_SPARC = 2 EM_386 = 3 EM_68K = 4 EM_88K = 5 EM_860 = 7 EM_MIPS = 8 EM_S370 = 9 EM_MIPS_RS3_LE = 10 EM_PARISC = 15 EM_VPP500 = 17 EM_SPARC32PLUS = 18 EM_960 = 19 EM_PPC = 20 EM_PPC64 = 21 EM_S390 = 22 EM_V800 = 36 EM_FR20 = 37 EM_RH32 = 38 EM_RCE = 39 EM_ARM = 40 EM_SH = 42 EM_SPARCV9 = 43 EM_TRICORE = 44 EM_ARC = 45 EM_H8_300 = 46 EM_H8_300H = 47 EM_H8S = 48 EM_H8_500 = 49 EM_IA_64 = 50 EM_MIPS_X = 51 EM_COLDFIRE = 52 EM_68HC12 = 53 EM_MMA = 54 EM_PCP = 55 EM_NCPU = 56 EM_NDR1 = 57 EM_STARCORE = 58 EM_ME16 = 59 EM_ST100 = 60 EM_TINYJ = 61 EM_X86_64 = 62 EM_AARCH64 = 183 EM_486 = 6 EM_MIPS_RS4_BE = 10 EM_ALPHA_STD = 41 EM_ALPHA = 0x9026 SHN_UNDEF = 0 SHN_LORESERVE = 0xff00 SHN_LOPROC = 0xff00 SHN_HIPROC = 0xff1f SHN_LOOS = 0xff20 SHN_HIOS = 0xff3f SHN_ABS = 0xfff1 SHN_COMMON = 0xfff2 SHN_XINDEX = 0xffff SHN_HIRESERVE = 0xffff SHT_NULL = 0 SHT_PROGBITS = 1 SHT_SYMTAB = 2 SHT_STRTAB = 3 SHT_RELA = 4 SHT_HASH = 5 SHT_DYNAMIC = 6 SHT_NOTE = 7 SHT_NOBITS = 8 SHT_REL = 9 SHT_SHLIB = 10 SHT_DYNSYM = 11 SHT_INIT_ARRAY = 14 SHT_FINI_ARRAY = 15 SHT_PREINIT_ARRAY = 16 SHT_GROUP = 17 SHT_SYMTAB_SHNDX = 18 SHT_LOOS = 0x60000000 SHT_HIOS = 0x6fffffff SHT_GNU_VERDEF = 0x6ffffffd SHT_GNU_VERNEED = 0x6ffffffe SHT_GNU_VERSYM = 0x6fffffff SHT_LOPROC = 0x70000000 SHT_ARM_ATTRIBUTES = 0x70000003 SHT_HIPROC = 0x7fffffff SHT_LOUSER = 0x80000000 SHT_HIUSER = 0xffffffff SHF_WRITE = 0x1 SHF_ALLOC = 0x2 SHF_EXECINSTR = 0x4 SHF_MERGE = 0x10 SHF_STRINGS = 0x20 SHF_INFO_LINK = 0x40 SHF_LINK_ORDER = 0x80 SHF_OS_NONCONFORMING = 0x100 SHF_GROUP = 0x200 SHF_TLS = 0x400 SHF_MASKOS = 0x0ff00000 SHF_MASKPROC = 0xf0000000 PT_NULL = 0 PT_LOAD = 1 PT_DYNAMIC = 2 PT_INTERP = 3 PT_NOTE = 4 PT_SHLIB = 5 PT_PHDR = 6 PT_TLS = 7 PT_LOOS = 0x60000000 PT_HIOS = 0x6fffffff PT_LOPROC = 0x70000000 PT_HIPROC = 0x7fffffff PT_GNU_STACK = 0x6474e551 PT_GNU_RELRO = 0x6474e552 PT_PAX_FLAGS = 0x65041580 PT_SUNWSTACK = 0x6ffffffb PF_X = 0x1 PF_W = 0x2 PF_R = 0x4 PF_MASKOS = 0x0ff00000 PF_MASKPROC = 0xf0000000 DT_NULL = 0 DT_NEEDED = 1 DT_PLTRELSZ = 2 DT_PLTGOT = 3 DT_HASH = 4 DT_STRTAB = 5 DT_SYMTAB = 6 DT_RELA = 7 DT_RELASZ = 8 DT_RELAENT = 9 DT_STRSZ = 10 DT_SYMENT = 11 DT_INIT = 12 DT_FINI = 13 DT_SONAME = 14 DT_RPATH = 15 DT_SYMBOLIC = 16 DT_REL = 17 DT_RELSZ = 18 DT_RELENT = 19 DT_PLTREL = 20 DT_DEBUG = 21 DT_TEXTREL = 22 DT_JMPREL = 23 DT_BIND_NOW = 24 DT_INIT_ARRAY = 25 DT_FINI_ARRAY = 26 DT_INIT_ARRAYSZ = 27 DT_FINI_ARRAYSZ = 28 DT_RUNPATH = 29 DT_FLAGS = 30 DT_ENCODING = 32 DT_PREINIT_ARRAY = 32 DT_PREINIT_ARRAYSZ = 33 DT_LOOS = 0x6000000d DT_HIOS = 0x6ffff000 DT_LOPROC = 0x70000000 DT_HIPROC = 0x7fffffff DT_VERNEED = 0x6ffffffe DT_VERNEEDNUM = 0x6fffffff DT_VERSYM = 0x6ffffff0 DT_PPC64_GLINK = DT_LOPROC + 0 DT_PPC64_OPT = DT_LOPROC + 3 DF_ORIGIN = 0x0001 DF_SYMBOLIC = 0x0002 DF_TEXTREL = 0x0004 DF_BIND_NOW = 0x0008 DF_STATIC_TLS = 0x0010 NT_PRSTATUS = 1 NT_FPREGSET = 2 NT_PRPSINFO = 3 STB_LOCAL = 0 STB_GLOBAL = 1 STB_WEAK = 2 STB_LOOS = 10 STB_HIOS = 12 STB_LOPROC = 13 STB_HIPROC = 15 STT_NOTYPE = 0 STT_OBJECT = 1 STT_FUNC = 2 STT_SECTION = 3 STT_FILE = 4 STT_COMMON = 5 STT_TLS = 6 STT_LOOS = 10 STT_HIOS = 12 STT_LOPROC = 13 STT_HIPROC = 15 STV_DEFAULT = 0x0 STV_INTERNAL = 0x1 STV_HIDDEN = 0x2 STV_PROTECTED = 0x3 STN_UNDEF = 0 )
const ( R_X86_64_NONE = 0 R_X86_64_64 = 1 R_X86_64_PC32 = 2 R_X86_64_GOT32 = 3 R_X86_64_PLT32 = 4 R_X86_64_COPY = 5 R_X86_64_GLOB_DAT = 6 R_X86_64_JMP_SLOT = 7 R_X86_64_RELATIVE = 8 R_X86_64_GOTPCREL = 9 R_X86_64_32 = 10 R_X86_64_32S = 11 R_X86_64_16 = 12 R_X86_64_PC16 = 13 R_X86_64_8 = 14 R_X86_64_PC8 = 15 R_X86_64_DTPMOD64 = 16 R_X86_64_DTPOFF64 = 17 R_X86_64_TPOFF64 = 18 R_X86_64_TLSGD = 19 R_X86_64_TLSLD = 20 R_X86_64_DTPOFF32 = 21 R_X86_64_GOTTPOFF = 22 R_X86_64_TPOFF32 = 23 R_X86_64_PC64 = 24 R_X86_64_GOTOFF64 = 25 R_X86_64_GOTPC32 = 26 R_X86_64_GOT64 = 27 R_X86_64_GOTPCREL64 = 28 R_X86_64_GOTPC64 = 29 R_X86_64_GOTPLT64 = 30 R_X86_64_PLTOFF64 = 31 R_X86_64_SIZE32 = 32 R_X86_64_SIZE64 = 33 R_X86_64_GOTPC32_TLSDEC = 34 R_X86_64_TLSDESC_CALL = 35 R_X86_64_TLSDESC = 36 R_X86_64_IRELATIVE = 37 R_X86_64_PC32_BND = 40 R_X86_64_GOTPCRELX = 41 R_X86_64_REX_GOTPCRELX = 42 R_AARCH64_ABS64 = 257 R_AARCH64_ABS32 = 258 R_AARCH64_CALL26 = 283 R_AARCH64_ADR_PREL_PG_HI21 = 275 R_AARCH64_ADD_ABS_LO12_NC = 277 R_AARCH64_LDST8_ABS_LO12_NC = 278 R_AARCH64_LDST16_ABS_LO12_NC = 284 R_AARCH64_LDST32_ABS_LO12_NC = 285 R_AARCH64_LDST64_ABS_LO12_NC = 286 R_AARCH64_ADR_GOT_PAGE = 311 R_AARCH64_LD64_GOT_LO12_NC = 312 R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 = 541 R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC = 542 R_AARCH64_TLSLE_MOVW_TPREL_G0 = 547 R_ALPHA_NONE = 0 R_ALPHA_REFLONG = 1 R_ALPHA_REFQUAD = 2 R_ALPHA_GPREL32 = 3 R_ALPHA_LITERAL = 4 R_ALPHA_LITUSE = 5 R_ALPHA_GPDISP = 6 R_ALPHA_BRADDR = 7 R_ALPHA_HINT = 8 R_ALPHA_SREL16 = 9 R_ALPHA_SREL32 = 10 R_ALPHA_SREL64 = 11 R_ALPHA_OP_PUSH = 12 R_ALPHA_OP_STORE = 13 R_ALPHA_OP_PSUB = 14 R_ALPHA_OP_PRSHIFT = 15 R_ALPHA_GPVALUE = 16 R_ALPHA_GPRELHIGH = 17 R_ALPHA_GPRELLOW = 18 R_ALPHA_IMMED_GP_16 = 19 R_ALPHA_IMMED_GP_HI32 = 20 R_ALPHA_IMMED_SCN_HI32 = 21 R_ALPHA_IMMED_BR_HI32 = 22 R_ALPHA_IMMED_LO32 = 23 R_ALPHA_COPY = 24 R_ALPHA_GLOB_DAT = 25 R_ALPHA_JMP_SLOT = 26 R_ALPHA_RELATIVE = 27 R_ARM_NONE = 0 R_ARM_PC24 = 1 R_ARM_ABS32 = 2 R_ARM_REL32 = 3 R_ARM_PC13 = 4 R_ARM_ABS16 = 5 R_ARM_ABS12 = 6 R_ARM_THM_ABS5 = 7 R_ARM_ABS8 = 8 R_ARM_SBREL32 = 9 R_ARM_THM_PC22 = 10 R_ARM_THM_PC8 = 11 R_ARM_AMP_VCALL9 = 12 R_ARM_SWI24 = 13 R_ARM_THM_SWI8 = 14 R_ARM_XPC25 = 15 R_ARM_THM_XPC22 = 16 R_ARM_COPY = 20 R_ARM_GLOB_DAT = 21 R_ARM_JUMP_SLOT = 22 R_ARM_RELATIVE = 23 R_ARM_GOTOFF = 24 R_ARM_GOTPC = 25 R_ARM_GOT32 = 26 R_ARM_PLT32 = 27 R_ARM_CALL = 28 R_ARM_JUMP24 = 29 R_ARM_V4BX = 40 R_ARM_GOT_PREL = 96 R_ARM_GNU_VTENTRY = 100 R_ARM_GNU_VTINHERIT = 101 R_ARM_TLS_IE32 = 107 R_ARM_TLS_LE32 = 108 R_ARM_RSBREL32 = 250 R_ARM_THM_RPC22 = 251 R_ARM_RREL32 = 252 R_ARM_RABS32 = 253 R_ARM_RPC24 = 254 R_ARM_RBASE = 255 R_386_NONE = 0 R_386_32 = 1 R_386_PC32 = 2 R_386_GOT32 = 3 R_386_PLT32 = 4 R_386_COPY = 5 R_386_GLOB_DAT = 6 R_386_JMP_SLOT = 7 R_386_RELATIVE = 8 R_386_GOTOFF = 9 R_386_GOTPC = 10 R_386_TLS_TPOFF = 14 R_386_TLS_IE = 15 R_386_TLS_GOTIE = 16 R_386_TLS_LE = 17 R_386_TLS_GD = 18 R_386_TLS_LDM = 19 R_386_TLS_GD_32 = 24 R_386_TLS_GD_PUSH = 25 R_386_TLS_GD_CALL = 26 R_386_TLS_GD_POP = 27 R_386_TLS_LDM_32 = 28 R_386_TLS_LDM_PUSH = 29 R_386_TLS_LDM_CALL = 30 R_386_TLS_LDM_POP = 31 R_386_TLS_LDO_32 = 32 R_386_TLS_IE_32 = 33 R_386_TLS_LE_32 = 34 R_386_TLS_DTPMOD32 = 35 R_386_TLS_DTPOFF32 = 36 R_386_TLS_TPOFF32 = 37 R_386_TLS_GOTDESC = 39 R_386_TLS_DESC_CALL = 40 R_386_TLS_DESC = 41 R_386_IRELATIVE = 42 R_386_GOT32X = 43 R_MIPS_NONE = 0 R_MIPS_16 = 1 R_MIPS_32 = 2 R_MIPS_REL32 = 3 R_MIPS_26 = 4 R_MIPS_HI16 = 5 R_MIPS_LO16 = 6 R_MIPS_GPREL16 = 7 R_MIPS_LITERAL = 8 R_MIPS_GOT16 = 9 R_MIPS_PC16 = 10 R_MIPS_CALL16 = 11 R_MIPS_GPREL32 = 12 R_MIPS_SHIFT5 = 16 R_MIPS_SHIFT6 = 17 R_MIPS_64 = 18 R_MIPS_GOT_DISP = 19 R_MIPS_GOT_PAGE = 20 R_MIPS_GOT_OFST = 21 R_MIPS_GOT_HI16 = 22 R_MIPS_GOT_LO16 = 23 R_MIPS_SUB = 24 R_MIPS_INSERT_A = 25 R_MIPS_INSERT_B = 26 R_MIPS_DELETE = 27 R_MIPS_HIGHER = 28 R_MIPS_HIGHEST = 29 R_MIPS_CALL_HI16 = 30 R_MIPS_CALL_LO16 = 31 R_MIPS_SCN_DISP = 32 R_MIPS_REL16 = 33 R_MIPS_ADD_IMMEDIATE = 34 R_MIPS_PJUMP = 35 R_MIPS_RELGOT = 36 R_MIPS_JALR = 37 R_MIPS_TLS_DTPMOD32 = 38 R_MIPS_TLS_DTPREL32 = 39 R_MIPS_TLS_DTPMOD64 = 40 R_MIPS_TLS_DTPREL64 = 41 R_MIPS_TLS_GD = 42 R_MIPS_TLS_LDM = 43 R_MIPS_TLS_DTPREL_HI16 = 44 R_MIPS_TLS_DTPREL_LO16 = 45 R_MIPS_TLS_GOTTPREL = 46 R_MIPS_TLS_TPREL32 = 47 R_MIPS_TLS_TPREL64 = 48 R_MIPS_TLS_TPREL_HI16 = 49 R_MIPS_TLS_TPREL_LO16 = 50 R_PPC_NONE = 0 R_PPC_ADDR32 = 1 R_PPC_ADDR24 = 2 R_PPC_ADDR16 = 3 R_PPC_ADDR16_LO = 4 R_PPC_ADDR16_HI = 5 R_PPC_ADDR16_HA = 6 R_PPC_ADDR14 = 7 R_PPC_ADDR14_BRTAKEN = 8 R_PPC_ADDR14_BRNTAKEN = 9 R_PPC_REL24 = 10 R_PPC_REL14 = 11 R_PPC_REL14_BRTAKEN = 12 R_PPC_REL14_BRNTAKEN = 13 R_PPC_GOT16 = 14 R_PPC_GOT16_LO = 15 R_PPC_GOT16_HI = 16 R_PPC_GOT16_HA = 17 R_PPC_PLTREL24 = 18 R_PPC_COPY = 19 R_PPC_GLOB_DAT = 20 R_PPC_JMP_SLOT = 21 R_PPC_RELATIVE = 22 R_PPC_LOCAL24PC = 23 R_PPC_UADDR32 = 24 R_PPC_UADDR16 = 25 R_PPC_REL32 = 26 R_PPC_PLT32 = 27 R_PPC_PLTREL32 = 28 R_PPC_PLT16_LO = 29 R_PPC_PLT16_HI = 30 R_PPC_PLT16_HA = 31 R_PPC_SDAREL16 = 32 R_PPC_SECTOFF = 33 R_PPC_SECTOFF_LO = 34 R_PPC_SECTOFF_HI = 35 R_PPC_SECTOFF_HA = 36 R_PPC_TLS = 67 R_PPC_DTPMOD32 = 68 R_PPC_TPREL16 = 69 R_PPC_TPREL16_LO = 70 R_PPC_TPREL16_HI = 71 R_PPC_TPREL16_HA = 72 R_PPC_TPREL32 = 73 R_PPC_DTPREL16 = 74 R_PPC_DTPREL16_LO = 75 R_PPC_DTPREL16_HI = 76 R_PPC_DTPREL16_HA = 77 R_PPC_DTPREL32 = 78 R_PPC_GOT_TLSGD16 = 79 R_PPC_GOT_TLSGD16_LO = 80 R_PPC_GOT_TLSGD16_HI = 81 R_PPC_GOT_TLSGD16_HA = 82 R_PPC_GOT_TLSLD16 = 83 R_PPC_GOT_TLSLD16_LO = 84 R_PPC_GOT_TLSLD16_HI = 85 R_PPC_GOT_TLSLD16_HA = 86 R_PPC_GOT_TPREL16 = 87 R_PPC_GOT_TPREL16_LO = 88 R_PPC_GOT_TPREL16_HI = 89 R_PPC_GOT_TPREL16_HA = 90 R_PPC_EMB_NADDR32 = 101 R_PPC_EMB_NADDR16 = 102 R_PPC_EMB_NADDR16_LO = 103 R_PPC_EMB_NADDR16_HI = 104 R_PPC_EMB_NADDR16_HA = 105 R_PPC_EMB_SDAI16 = 106 R_PPC_EMB_SDA2I16 = 107 R_PPC_EMB_SDA2REL = 108 R_PPC_EMB_SDA21 = 109 R_PPC_EMB_MRKREF = 110 R_PPC_EMB_RELSEC16 = 111 R_PPC_EMB_RELST_LO = 112 R_PPC_EMB_RELST_HI = 113 R_PPC_EMB_RELST_HA = 114 R_PPC_EMB_BIT_FLD = 115 R_PPC_EMB_RELSDA = 116 R_PPC64_ADDR32 = R_PPC_ADDR32 R_PPC64_ADDR16_LO = R_PPC_ADDR16_LO R_PPC64_ADDR16_HA = R_PPC_ADDR16_HA R_PPC64_REL24 = R_PPC_REL24 R_PPC64_GOT16_HA = R_PPC_GOT16_HA R_PPC64_JMP_SLOT = R_PPC_JMP_SLOT R_PPC64_TPREL16 = R_PPC_TPREL16 R_PPC64_ADDR64 = 38 R_PPC64_TOC16 = 47 R_PPC64_TOC16_LO = 48 R_PPC64_TOC16_HI = 49 R_PPC64_TOC16_HA = 50 R_PPC64_ADDR16_LO_DS = 57 R_PPC64_GOT16_LO_DS = 59 R_PPC64_TOC16_DS = 63 R_PPC64_TOC16_LO_DS = 64 R_PPC64_TLS = 67 R_PPC64_GOT_TPREL16_LO_DS = 88 R_PPC64_GOT_TPREL16_HA = 90 R_PPC64_REL16_LO = 250 R_PPC64_REL16_HI = 251 R_PPC64_REL16_HA = 252 R_SPARC_NONE = 0 R_SPARC_8 = 1 R_SPARC_16 = 2 R_SPARC_32 = 3 R_SPARC_DISP8 = 4 R_SPARC_DISP16 = 5 R_SPARC_DISP32 = 6 R_SPARC_WDISP30 = 7 R_SPARC_WDISP22 = 8 R_SPARC_HI22 = 9 R_SPARC_22 = 10 R_SPARC_13 = 11 R_SPARC_LO10 = 12 R_SPARC_GOT10 = 13 R_SPARC_GOT13 = 14 R_SPARC_GOT22 = 15 R_SPARC_PC10 = 16 R_SPARC_PC22 = 17 R_SPARC_WPLT30 = 18 R_SPARC_COPY = 19 R_SPARC_GLOB_DAT = 20 R_SPARC_JMP_SLOT = 21 R_SPARC_RELATIVE = 22 R_SPARC_UA32 = 23 R_SPARC_PLT32 = 24 R_SPARC_HIPLT22 = 25 R_SPARC_LOPLT10 = 26 R_SPARC_PCPLT32 = 27 R_SPARC_PCPLT22 = 28 R_SPARC_PCPLT10 = 29 R_SPARC_10 = 30 R_SPARC_11 = 31 R_SPARC_64 = 32 R_SPARC_OLO10 = 33 R_SPARC_HH22 = 34 R_SPARC_HM10 = 35 R_SPARC_LM22 = 36 R_SPARC_PC_HH22 = 37 R_SPARC_PC_HM10 = 38 R_SPARC_PC_LM22 = 39 R_SPARC_WDISP16 = 40 R_SPARC_WDISP19 = 41 R_SPARC_GLOB_JMP = 42 R_SPARC_7 = 43 R_SPARC_5 = 44 R_SPARC_6 = 45 R_SPARC_DISP64 = 46 R_SPARC_PLT64 = 47 R_SPARC_HIX22 = 48 R_SPARC_LOX10 = 49 R_SPARC_H44 = 50 R_SPARC_M44 = 51 R_SPARC_L44 = 52 R_SPARC_REGISTER = 53 R_SPARC_UA64 = 54 R_SPARC_UA16 = 55 R_390_NONE = 0 R_390_8 = 1 R_390_12 = 2 R_390_16 = 3 R_390_32 = 4 R_390_PC32 = 5 R_390_GOT12 = 6 R_390_GOT32 = 7 R_390_PLT32 = 8 R_390_COPY = 9 R_390_GLOB_DAT = 10 R_390_JMP_SLOT = 11 R_390_RELATIVE = 12 R_390_GOTOFF = 13 R_390_GOTPC = 14 R_390_GOT16 = 15 R_390_PC16 = 16 R_390_PC16DBL = 17 R_390_PLT16DBL = 18 R_390_PC32DBL = 19 R_390_PLT32DBL = 20 R_390_GOTPCDBL = 21 R_390_64 = 22 R_390_PC64 = 23 R_390_GOT64 = 24 R_390_PLT64 = 25 R_390_GOTENT = 26 R_390_GOTOFF16 = 27 R_390_GOTOFF64 = 28 R_390_GOTPLT12 = 29 R_390_GOTPLT16 = 30 R_390_GOTPLT32 = 31 R_390_GOTPLT64 = 32 R_390_GOTPLTENT = 33 R_390_GOTPLTOFF16 = 34 R_390_GOTPLTOFF32 = 35 R_390_GOTPLTOFF64 = 36 R_390_TLS_LOAD = 37 R_390_TLS_GDCALL = 38 R_390_TLS_LDCALL = 39 R_390_TLS_GD32 = 40 R_390_TLS_GD64 = 41 R_390_TLS_GOTIE12 = 42 R_390_TLS_GOTIE32 = 43 R_390_TLS_GOTIE64 = 44 R_390_TLS_LDM32 = 45 R_390_TLS_LDM64 = 46 R_390_TLS_IE32 = 47 R_390_TLS_IE64 = 48 R_390_TLS_IEENT = 49 R_390_TLS_LE32 = 50 R_390_TLS_LE64 = 51 R_390_TLS_LDO32 = 52 R_390_TLS_LDO64 = 53 R_390_TLS_DTPMOD = 54 R_390_TLS_DTPOFF = 55 R_390_TLS_TPOFF = 56 R_390_20 = 57 R_390_GOT20 = 58 R_390_GOTPLT20 = 59 R_390_TLS_GOTIE20 = 60 ARM_MAGIC_TRAMP_NUMBER = 0x5c000003 )
* Relocation types.
const ( ELF64HDRSIZE = 64 ELF64PHDRSIZE = 56 ELF64SHDRSIZE = 64 ELF64RELSIZE = 16 ELF64RELASIZE = 24 ELF64SYMSIZE = 24 ELF32HDRSIZE = 52 ELF32PHDRSIZE = 32 ELF32SHDRSIZE = 40 ELF32SYMSIZE = 16 ELF32RELSIZE = 8 )
* Go linker interface
const ( ELF_NOTE_NETBSD_NAMESZ = 7 ELF_NOTE_NETBSD_DESCSZ = 4 ELF_NOTE_NETBSD_TAG = 1 ELF_NOTE_NETBSD_VERSION = 599000000 /* NetBSD 5.99 */ )
NetBSD Signature (as per sys/exec_elf.h)
const ( ELF_NOTE_OPENBSD_NAMESZ = 8 ELF_NOTE_OPENBSD_DESCSZ = 4 ELF_NOTE_OPENBSD_TAG = 1 ELF_NOTE_OPENBSD_VERSION = 0 )
OpenBSD Signature
const ( ELF_NOTE_BUILDINFO_NAMESZ = 4 ELF_NOTE_BUILDINFO_TAG = 3 )
Build info note
const ( ELF_NOTE_GOPKGLIST_TAG = 1 ELF_NOTE_GOABIHASH_TAG = 2 ELF_NOTE_GODEPS_TAG = 3 ELF_NOTE_GOBUILDID_TAG = 4 )
Go specific notes
const ( ElfClassNone = 0 ElfClass32 = 1 ElfClass64 = 2 )
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 ( ElfDataNone = 0 ElfDataLsb = 1 ElfDataMsb = 2 )
const ( ElfTypeNone = 0 ElfTypeRelocatable = 1 ElfTypeExecutable = 2 ElfTypeCore = 4 )
const ( ElfMachNone = 0 ElfMach32100 = 1 ElfMachSparc = 2 ElfMach386 = 3 ElfMach68000 = 4 ElfMach88000 = 5 ElfMach486 = 6 ElfMach860 = 7 ElfMachMips = 8 ElfMachS370 = 9 ElfMachMipsLe = 10 ElfMachParisc = 15 ElfMachVpp500 = 17 ElfMachSparc32Plus = 18 ElfMach960 = 19 ElfMachPower = 20 ElfMachPower64 = 21 ElfMachS390 = 22 ElfMachV800 = 36 ElfMachFr20 = 37 ElfMachRh32 = 38 ElfMachRce = 39 ElfMachArm = 40 ElfMachAlpha = 41 ElfMachSH = 42 ElfMachSparc9 = 43 ElfMachAmd64 = 62 ElfMachArm64 = 183 )
const ( ElfAbiNone = 0 ElfAbiSystemV = 0 ElfAbiHPUX = 1 ElfAbiNetBSD = 2 ElfAbiLinux = 3 ElfAbiSolaris = 6 ElfAbiAix = 7 ElfAbiIrix = 8 ElfAbiFreeBSD = 9 ElfAbiTru64 = 10 ElfAbiModesto = 11 ElfAbiOpenBSD = 12 ElfAbiARM = 97 ElfAbiEmbedded = 255 )
const ( ElfSectNone = 0 ElfSectProgbits = 1 ElfSectSymtab = 2 ElfSectStrtab = 3 ElfSectRela = 4 ElfSectHash = 5 ElfSectDynamic = 6 ElfSectNote = 7 ElfSectNobits = 8 ElfSectRel = 9 ElfSectShlib = 10 ElfSectDynsym = 11 ElfSectFlagWrite = 0x1 ElfSectFlagAlloc = 0x2 ElfSectFlagExec = 0x4 )
const ( ElfSymBindLocal = 0 ElfSymBindGlobal = 1 ElfSymBindWeak = 2 )
const ( ElfSymTypeNone = 0 ElfSymTypeObject = 1 ElfSymTypeFunc = 2 ElfSymTypeSection = 3 ElfSymTypeFile = 4 )
const ( ElfSymShnNone = 0 ElfSymShnAbs = 0xFFF1 ElfSymShnCommon = 0xFFF2 )
const ( ElfProgNone = 0 ElfProgLoad = 1 ElfProgDynamic = 2 ElfProgInterp = 3 ElfProgNote = 4 ElfProgShlib = 5 ElfProgPhdr = 6 ElfProgFlagExec = 0x1 ElfProgFlagWrite = 0x2 ElfProgFlagRead = 0x4 )
const ( ElfNotePrStatus = 1 ElfNotePrFpreg = 2 ElfNotePrPsinfo = 3 ElfNotePrTaskstruct = 4 ElfNotePrAuxv = 6 ElfNotePrXfpreg = 0x46e62b7f )
const ( TagFile = 1 TagCPUName = 4 TagCPURawName = 5 TagCompatibility = 32 TagNoDefaults = 64 TagAlsoCompatibleWith = 65 TagABIVFPArgs = 28 )
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 ( 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 )
const ( IMAGE_SYM_UNDEFINED = 0 IMAGE_SYM_ABSOLUTE = -1 IMAGE_SYM_DEBUG = -2 IMAGE_SYM_TYPE_NULL = 0 IMAGE_SYM_TYPE_VOID = 1 IMAGE_SYM_TYPE_CHAR = 2 IMAGE_SYM_TYPE_SHORT = 3 IMAGE_SYM_TYPE_INT = 4 IMAGE_SYM_TYPE_LONG = 5 IMAGE_SYM_TYPE_FLOAT = 6 IMAGE_SYM_TYPE_DOUBLE = 7 IMAGE_SYM_TYPE_STRUCT = 8 IMAGE_SYM_TYPE_UNION = 9 IMAGE_SYM_TYPE_ENUM = 10 IMAGE_SYM_TYPE_MOE = 11 IMAGE_SYM_TYPE_BYTE = 12 IMAGE_SYM_TYPE_WORD = 13 IMAGE_SYM_TYPE_UINT = 14 IMAGE_SYM_TYPE_DWORD = 15 IMAGE_SYM_TYPE_PCODE = 32768 IMAGE_SYM_DTYPE_NULL = 0 IMAGE_SYM_DTYPE_POINTER = 0x10 IMAGE_SYM_DTYPE_FUNCTION = 0x20 IMAGE_SYM_DTYPE_ARRAY = 0x30 IMAGE_SYM_CLASS_END_OF_FUNCTION = -1 IMAGE_SYM_CLASS_NULL = 0 IMAGE_SYM_CLASS_AUTOMATIC = 1 IMAGE_SYM_CLASS_EXTERNAL = 2 IMAGE_SYM_CLASS_STATIC = 3 IMAGE_SYM_CLASS_REGISTER = 4 IMAGE_SYM_CLASS_EXTERNAL_DEF = 5 IMAGE_SYM_CLASS_LABEL = 6 IMAGE_SYM_CLASS_UNDEFINED_LABEL = 7 IMAGE_SYM_CLASS_MEMBER_OF_STRUCT = 8 IMAGE_SYM_CLASS_ARGUMENT = 9 IMAGE_SYM_CLASS_STRUCT_TAG = 10 IMAGE_SYM_CLASS_MEMBER_OF_UNION = 11 IMAGE_SYM_CLASS_UNION_TAG = 12 IMAGE_SYM_CLASS_TYPE_DEFINITION = 13 IMAGE_SYM_CLASS_UNDEFINED_STATIC = 14 IMAGE_SYM_CLASS_ENUM_TAG = 15 IMAGE_SYM_CLASS_MEMBER_OF_ENUM = 16 IMAGE_SYM_CLASS_REGISTER_PARAM = 17 IMAGE_SYM_CLASS_BIT_FIELD = 18 IMAGE_SYM_CLASS_FAR_EXTERNAL = 68 /* Not in PECOFF v8 spec */ IMAGE_SYM_CLASS_BLOCK = 100 IMAGE_SYM_CLASS_FUNCTION = 101 IMAGE_SYM_CLASS_END_OF_STRUCT = 102 IMAGE_SYM_CLASS_FILE = 103 IMAGE_SYM_CLASS_SECTION = 104 IMAGE_SYM_CLASS_WEAK_EXTERNAL = 105 IMAGE_SYM_CLASS_CLR_TOKEN = 107 IMAGE_REL_I386_ABSOLUTE = 0x0000 IMAGE_REL_I386_DIR16 = 0x0001 IMAGE_REL_I386_REL16 = 0x0002 IMAGE_REL_I386_DIR32 = 0x0006 IMAGE_REL_I386_DIR32NB = 0x0007 IMAGE_REL_I386_SEG12 = 0x0009 IMAGE_REL_I386_SECTION = 0x000A IMAGE_REL_I386_SECREL = 0x000B IMAGE_REL_I386_TOKEN = 0x000C IMAGE_REL_I386_SECREL7 = 0x000D IMAGE_REL_I386_REL32 = 0x0014 IMAGE_REL_AMD64_ABSOLUTE = 0x0000 IMAGE_REL_AMD64_ADDR64 = 0x0001 IMAGE_REL_AMD64_ADDR32 = 0x0002 IMAGE_REL_AMD64_ADDR32NB = 0x0003 IMAGE_REL_AMD64_REL32 = 0x0004 IMAGE_REL_AMD64_REL32_1 = 0x0005 IMAGE_REL_AMD64_REL32_2 = 0x0006 IMAGE_REL_AMD64_REL32_3 = 0x0007 IMAGE_REL_AMD64_REL32_4 = 0x0008 IMAGE_REL_AMD64_REL32_5 = 0x0009 IMAGE_REL_AMD64_SECTION = 0x000A IMAGE_REL_AMD64_SECREL = 0x000B IMAGE_REL_AMD64_SECREL7 = 0x000C IMAGE_REL_AMD64_TOKEN = 0x000D IMAGE_REL_AMD64_SREL32 = 0x000E IMAGE_REL_AMD64_PAIR = 0x000F IMAGE_REL_AMD64_SSPAN32 = 0x0010 )
const ( FileObj = 0 + iota ArchiveObj Pkgdef )
whence for ldpkg
const ( TextSym SymbolType = 'T' DataSym = 'D' BSSSym = 'B' UndefinedSym = 'U' TLSSym = 't' FileSym = 'f' FrameSym = 'm' ParamSym = 'p' AutoSym = 'a' )
const ( MACHO_CPU_AMD64 = 1<<24 | 7 MACHO_CPU_386 = 7 MACHO_SUBCPU_X86 = 3 MACHO_CPU_ARM = 12 MACHO_SUBCPU_ARM = 0 MACHO_SUBCPU_ARMV7 = 9 MACHO_CPU_ARM64 = 1<<24 | 12 MACHO_SUBCPU_ARM64_ALL = 0 MACHO32SYMSIZE = 12 MACHO64SYMSIZE = 16 MACHO_X86_64_RELOC_UNSIGNED = 0 MACHO_X86_64_RELOC_SIGNED = 1 MACHO_X86_64_RELOC_BRANCH = 2 MACHO_X86_64_RELOC_GOT_LOAD = 3 MACHO_X86_64_RELOC_GOT = 4 MACHO_X86_64_RELOC_SUBTRACTOR = 5 MACHO_X86_64_RELOC_SIGNED_1 = 6 MACHO_X86_64_RELOC_SIGNED_2 = 7 MACHO_X86_64_RELOC_SIGNED_4 = 8 MACHO_ARM_RELOC_VANILLA = 0 MACHO_ARM_RELOC_PAIR = 1 MACHO_ARM_RELOC_SECTDIFF = 2 MACHO_ARM_RELOC_BR24 = 5 MACHO_ARM64_RELOC_UNSIGNED = 0 MACHO_ARM64_RELOC_BRANCH26 = 2 MACHO_ARM64_RELOC_PAGE21 = 3 MACHO_ARM64_RELOC_PAGEOFF12 = 4 MACHO_ARM64_RELOC_ADDEND = 10 MACHO_GENERIC_RELOC_VANILLA = 0 MACHO_FAKE_GOTPCREL = 100 )
const ( SymKindLocal = 0 + iota SymKindExtdef SymKindUndef NumSymKind )
const ( LC_ID_DYLIB = 0xd LC_LOAD_DYLINKER = 0xe LC_PREBOUND_DYLIB = 0x10 LC_LOAD_WEAK_DYLIB = 0x18 LC_UUID = 0x1b LC_RPATH = 0x8000001c LC_CODE_SIGNATURE = 0x1d LC_SEGMENT_SPLIT_INFO = 0x1e LC_REEXPORT_DYLIB = 0x8000001f LC_ENCRYPTION_INFO = 0x21 LC_DYLD_INFO = 0x22 LC_DYLD_INFO_ONLY = 0x80000022 LC_VERSION_MIN_MACOSX = 0x24 LC_VERSION_MIN_IPHONEOS = 0x25 LC_FUNCTION_STARTS = 0x26 LC_MAIN = 0x80000028 LC_DATA_IN_CODE = 0x29 LC_SOURCE_VERSION = 0x2A LC_DYLIB_CODE_SIGN_DRS = 0x2B LC_ENCRYPTION_INFO_64 = 0x2C )
const ( BUCKETSIZE = 256 * MINFUNC SUBBUCKETS = 16 SUBBUCKETSIZE = BUCKETSIZE / SUBBUCKETS NOIDX = 0x7fffffff )
const ( PEBASE = 0x00400000 // SectionAlignment must be greater than or equal to FileAlignment. // The default is the page size for the architecture. PESECTALIGN = 0x1000 // FileAlignment should be a power of 2 between 512 and 64 K, inclusive. // The default is 512. If the SectionAlignment is less than // the architecture's page size, then FileAlignment must match SectionAlignment. PEFILEALIGN = 2 << 8 )
const ( IMAGE_FILE_MACHINE_I386 = 0x14c IMAGE_FILE_MACHINE_AMD64 = 0x8664 IMAGE_FILE_RELOCS_STRIPPED = 0x0001 IMAGE_FILE_EXECUTABLE_IMAGE = 0x0002 IMAGE_FILE_LINE_NUMS_STRIPPED = 0x0004 IMAGE_FILE_LARGE_ADDRESS_AWARE = 0x0020 IMAGE_FILE_32BIT_MACHINE = 0x0100 IMAGE_FILE_DEBUG_STRIPPED = 0x0200 IMAGE_SCN_CNT_CODE = 0x00000020 IMAGE_SCN_CNT_INITIALIZED_DATA = 0x00000040 IMAGE_SCN_CNT_UNINITIALIZED_DATA = 0x00000080 IMAGE_SCN_MEM_EXECUTE = 0x20000000 IMAGE_SCN_MEM_READ = 0x40000000 IMAGE_SCN_MEM_WRITE = 0x80000000 IMAGE_SCN_MEM_DISCARDABLE = 0x2000000 IMAGE_SCN_LNK_NRELOC_OVFL = 0x1000000 IMAGE_SCN_ALIGN_32BYTES = 0x600000 IMAGE_DIRECTORY_ENTRY_EXPORT = 0 IMAGE_DIRECTORY_ENTRY_IMPORT = 1 IMAGE_DIRECTORY_ENTRY_RESOURCE = 2 IMAGE_DIRECTORY_ENTRY_EXCEPTION = 3 IMAGE_DIRECTORY_ENTRY_SECURITY = 4 IMAGE_DIRECTORY_ENTRY_BASERELOC = 5 IMAGE_DIRECTORY_ENTRY_DEBUG = 6 IMAGE_DIRECTORY_ENTRY_COPYRIGHT = 7 IMAGE_DIRECTORY_ENTRY_ARCHITECTURE = 7 IMAGE_DIRECTORY_ENTRY_GLOBALPTR = 8 IMAGE_DIRECTORY_ENTRY_TLS = 9 IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG = 10 IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT = 11 IMAGE_DIRECTORY_ENTRY_IAT = 12 IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT = 13 IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR = 14 IMAGE_SUBSYSTEM_WINDOWS_GUI = 2 IMAGE_SUBSYSTEM_WINDOWS_CUI = 3 )
const (
ARMAG = "!<arch>\n"
)
const (
COMPUNITHEADERSIZE = 4 + 2 + 4 + 1
)
* Walk DWarfDebugInfoEntries, and emit .debug_info
const (
ELFRESERVE = 4096
)
* Total amount of space to reserve at the start of the file * for Header, PHeaders, SHeaders, and interp. * May waste some. * On FreeBSD, cannot be larger than a page.
const (
INITIAL_MACHO_HEADR = 4 * 1024
)
* Total amount of space to reserve at the start of the file * for Header, PHeaders, and SHeaders. * May waste some.
const (
MINFUNC = 16 // minimum size for a function
)
const (
NSECT = 400
)
* We use the 64-bit data structures on both 32- and 64-bit machines * in order to write the code just once. The 64-bit data structure is * written in the 32-bit format on the 32-bit machines.
Variables ¶
var ( Linkmode LinkMode Buildmode BuildMode )
var ( Iself bool Nelfsym int = 1 )
var ( Thearch Arch Lcsize int32 Spsize int32 Symsize int32 )
var ( FlagC = flag.Bool("c", false, "dump call graph") FlagD = flag.Bool("d", false, "disable dynamic executable") FlagS = flag.Bool("s", false, "disable symbol table") FlagW = flag.Bool("w", false, "disable DWARF generation") Flag8 bool // use 64-bit addresses in symbol table FlagDebugTramp = flag.Int("debugtramp", 0, "debug trampolines") FlagRound = flag.Int("R", -1, "set address rounding `quantum`") FlagTextAddr = flag.Int64("T", -1, "set text segment `address`") FlagDataAddr = flag.Int64("D", -1, "set data segment `address`") )
Flags used by the linker. The exported flags are used by the architecture-specific packages.
var ELF_NOTE_BUILDINFO_NAME = []byte("GNU\x00")
var ELF_NOTE_GO_NAME = []byte("Go\x00\x00")
var ELF_NOTE_NETBSD_NAME = []byte("NetBSD\x00")
var ELF_NOTE_OPENBSD_NAME = []byte("OpenBSD\x00")
var ElfMagic = [4]uint8{0x7F, 'E', 'L', 'F'}
var Elfstrdat []byte
var PEFILEHEADR int32
var PESECTHEADR int32
Functions ¶
func Asmbelfsetup ¶
func Asmbelfsetup()
func Asmplan9sym ¶
func Asmplan9sym(ctxt *Link)
func Cwritestring ¶
func Cwritestring(s string)
func Domacholink ¶
func ELF32_R_INFO ¶
func ELF32_R_SYM ¶
func ELF32_R_TYPE ¶
func ELF32_ST_BIND ¶
func ELF32_ST_INFO ¶
func ELF32_ST_TYPE ¶
func ELF32_ST_VISIBILITY ¶
func ELF64_R_INFO ¶
func ELF64_R_SYM ¶
func ELF64_R_TYPE ¶
func ELF64_ST_BIND ¶
func ELF64_ST_INFO ¶
func ELF64_ST_TYPE ¶
func ELF64_ST_VISIBILITY ¶
func Elfadddynsym ¶
func Elfemitreloc ¶
func Elfemitreloc(ctxt *Link)
func Elfinit ¶
func Elfinit(ctxt *Link)
Initialize the global variable that describes the ELF header. It will be updated as we write section and prog headers.
func Elfwritedynentsymplus ¶
func Entryvalue ¶
func Errorf ¶
Errorf logs an error message.
If more than 20 errors have been printed, exit with an error.
Logging an error means that on exit cmd/link will delete any output file and return a non-zero error code.
func Exitf ¶
func Exitf(format string, a ...interface{})
Exitf logs an error message then calls Exit(2).
func LoadObjFile ¶
func Machoadddynlib ¶
func Machoadddynlib(lib string)
func Machoemitreloc ¶
func Machoemitreloc(ctxt *Link)
Types ¶
type Arch ¶
type Arch struct { Funcalign int Maxalign int Minalign int Dwarfregsp int Dwarfreglr int Linuxdynld string Freebsddynld string Netbsddynld string Openbsddynld string Dragonflydynld string Solarisdynld string Adddynrel func(*Link, *Symbol, *Reloc) bool Archinit func(*Link) Archreloc func(*Link, *Reloc, *Symbol, *int64) int Archrelocvariant func(*Link, *Reloc, *Symbol, int64) int64 Trampoline func(*Link, *Reloc, *Symbol) Asmb func(*Link) Elfreloc1 func(*Link, *Reloc, int64) int Elfsetupplt func(*Link) Gentext func(*Link) Machoreloc1 func(*Symbol, *Reloc, int64) int PEreloc1 func(*Symbol, *Reloc, int64) bool Wput func(uint16) Lput func(uint32) Vput func(uint64) Append16 func(b []byte, v uint16) []byte Append32 func(b []byte, v uint32) []byte Append64 func(b []byte, v uint64) []byte // TLSIEtoLE converts a TLS Initial Executable relocation to // a TLS Local Executable relocation. // // This is possible when a TLS IE relocation refers to a local // symbol in an executable, which is typical when internally // linking PIE binaries. TLSIEtoLE func(s *Symbol, off, size int) }
type Attribute ¶
type Attribute int16
Attribute is a set of common symbol attributes.
func (Attribute) CgoExportDynamic ¶
func (Attribute) CgoExportStatic ¶
func (Attribute) DuplicateOK ¶
func (Attribute) MakeTypelink ¶
func (Attribute) ReflectMethod ¶
func (Attribute) StackCheck ¶
type BuildMode ¶
type BuildMode uint8
A BuildMode indicates the sort of object we are building.
Possible build modes are the same as those for the -buildmode flag in cmd/go, and are documented in 'go help buildmode'.
type ElfHdrBytes ¶
type ElfHdrBytes64 ¶
type ElfProgBytes ¶
type ElfProgBytes struct { }
type ElfProgBytes64 ¶
type ElfProgBytes64 struct { }
type ElfSectBytes ¶
type ElfSectBytes64 ¶
type ElfSymBytes ¶
type ElfSymBytes64 ¶
type IMAGE_DATA_DIRECTORY ¶
type IMAGE_EXPORT_DIRECTORY ¶
type IMAGE_FILE_HEADER ¶
type IMAGE_IMPORT_DESCRIPTOR ¶
type IMAGE_OPTIONAL_HEADER ¶
type IMAGE_OPTIONAL_HEADER struct { Magic uint16 MajorLinkerVersion uint8 MinorLinkerVersion uint8 SizeOfCode uint32 SizeOfInitializedData uint32 SizeOfUninitializedData uint32 AddressOfEntryPoint uint32 BaseOfCode uint32 BaseOfData uint32 ImageBase uint32 SectionAlignment uint32 FileAlignment uint32 MajorOperatingSystemVersion uint16 MinorOperatingSystemVersion uint16 MajorImageVersion uint16 MinorImageVersion uint16 MajorSubsystemVersion uint16 MinorSubsystemVersion uint16 Win32VersionValue uint32 SizeOfImage uint32 SizeOfHeaders uint32 CheckSum uint32 Subsystem uint16 DllCharacteristics uint16 SizeOfStackReserve uint32 SizeOfStackCommit uint32 SizeOfHeapReserve uint32 SizeOfHeapCommit uint32 LoaderFlags uint32 NumberOfRvaAndSizes uint32 DataDirectory [16]IMAGE_DATA_DIRECTORY }
type IMAGE_SECTION_HEADER ¶
type Library ¶
type Link ¶
type Link struct { Syms *Symbols Arch *sys.Arch Debugvlog int Bso *bufio.Writer Loaded bool // set after all inputs have been loaded as symbols Tlsg *Symbol Libdir []string Library []*Library Shlibs []Shlib Tlsoffset int Textp []*Symbol Filesyms []*Symbol Moduledata *Symbol // contains filtered or unexported fields }
Link holds the context for writing object code from a compiler or for reading that input into the linker.
func (*Link) DynlinkingGo ¶
DynlinkingGo returns whether we are producing Go code that can live in separate shared libraries linked together at runtime.
func (*Link) FixedFrameSize ¶
The smallest possible offset from the hardware stack pointer to a local variable on the stack. Architectures that use a link register save its value on the stack in the function prologue and so always have a pointer between the hardware stack pointer and the local variable area.
type LinkMode ¶
type LinkMode uint8
LinkMode indicates whether an external linker is used for the final link.
type PE64_IMAGE_OPTIONAL_HEADER ¶
type PE64_IMAGE_OPTIONAL_HEADER struct { Magic uint16 MajorLinkerVersion uint8 MinorLinkerVersion uint8 SizeOfCode uint32 SizeOfInitializedData uint32 SizeOfUninitializedData uint32 AddressOfEntryPoint uint32 BaseOfCode uint32 ImageBase uint64 SectionAlignment uint32 FileAlignment uint32 MajorOperatingSystemVersion uint16 MinorOperatingSystemVersion uint16 MajorImageVersion uint16 MinorImageVersion uint16 MajorSubsystemVersion uint16 MinorSubsystemVersion uint16 Win32VersionValue uint32 SizeOfImage uint32 SizeOfHeaders uint32 CheckSum uint32 Subsystem uint16 DllCharacteristics uint16 SizeOfStackReserve uint64 SizeOfStackCommit uint64 SizeOfHeapReserve uint64 SizeOfHeapCommit uint64 LoaderFlags uint32 NumberOfRvaAndSizes uint32 DataDirectory [16]IMAGE_DATA_DIRECTORY }
X64
type Reloc ¶
type Reloc struct { Off int32 // offset to rewrite Siz uint8 // number of bytes to rewrite, 1, 2, or 4 Done uint8 // set to 1 when relocation is complete Variant RelocVariant // variation on Type Type obj.RelocType // the relocation type Add int64 // addend Xadd int64 // addend passed to external linker Sym *Symbol // symbol the relocation addresses Xsym *Symbol // symbol passed to external linker }
Reloc is a relocation.
The typical Reloc rewrites part of a symbol at offset Off to address Sym. A Reloc is stored in a slice on the Symbol it rewrites.
Relocations are generated by the compiler as the type cmd/internal/obj.Reloc, which is encoded into the object file wire format and decoded by the linker into this type. A separate type is used to hold linker-specific state about the relocation.
Some relocations are created by cmd/link.
type RelocVariant ¶
type RelocVariant uint8
RelocVariant is a linker-internal variation on a relocation.
const ( RV_NONE RelocVariant = iota RV_POWER_LO RV_POWER_HI RV_POWER_HA RV_POWER_DS // RV_390_DBL is a s390x-specific relocation variant that indicates that // the value to be placed into the relocatable field should first be // divided by 2. RV_390_DBL RV_CHECK_OVERFLOW RelocVariant = 1 << 7 RV_TYPE_MASK RelocVariant = RV_CHECK_OVERFLOW - 1 )
type Segment ¶
type Symbol ¶
type Symbol struct { Name string Extname string Type obj.SymKind Version int16 Attr Attribute Localentry uint8 Dynid int32 Plt int32 Got int32 Align int32 Elfsym int32 LocalElfsym int32 Value int64 Size int64 // ElfType is set for symbols read from shared libraries by ldshlibsyms. It // is not set for symbols defined by the packages being linked or by symbols // read by ldelf (and so is left as elf.STT_NOTYPE). ElfType elf.SymType Sub *Symbol Outer *Symbol Gotype *Symbol Reachparent *Symbol File string Dynimplib string Dynimpvers string Sect *Section FuncInfo *FuncInfo // P contains the raw symbol data. P []byte R []Reloc }
Symbol is an entry in the symbol table.
func (*Symbol) ElfsymForReloc ¶
type SymbolType ¶
type SymbolType int8