Constants & Variables
AOUTHSZ_EXEC32
const
#
const AOUTHSZ_EXEC32 = 72
AOUTHSZ_EXEC64
const
#
const AOUTHSZ_EXEC64 = 120
ARMAG
const
#
const ARMAG = "!\n"
ARM_MAGIC_TRAMP_NUMBER
const
#
const ARM_MAGIC_TRAMP_NUMBER = 0x5c000003
AutoSym
const
#
const AutoSym SymbolType = 'a'
BIND_IMMEDIATE_MASK
const
#
const BIND_IMMEDIATE_MASK = 0x0F
BIND_OPCODE_ADD_ADDR_ULEB
const
#
const BIND_OPCODE_ADD_ADDR_ULEB = 0x80
BIND_OPCODE_DONE
const
#
const BIND_OPCODE_DONE = 0x00
BIND_OPCODE_DO_BIND
const
#
const BIND_OPCODE_DO_BIND = 0x90
BIND_OPCODE_DO_BIND_ADD_ADDR_IMM_SCALED
const
#
const BIND_OPCODE_DO_BIND_ADD_ADDR_IMM_SCALED = 0xB0
BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB
const
#
const BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB = 0xA0
BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB
const
#
const BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB = 0xC0
BIND_OPCODE_MASK
const
#
const BIND_OPCODE_MASK = 0xF0
BIND_OPCODE_SET_ADDEND_SLEB
const
#
const BIND_OPCODE_SET_ADDEND_SLEB = 0x60
BIND_OPCODE_SET_DYLIB_ORDINAL_IMM
const
#
const BIND_OPCODE_SET_DYLIB_ORDINAL_IMM = 0x10
BIND_OPCODE_SET_DYLIB_ORDINAL_ULEB
const
#
const BIND_OPCODE_SET_DYLIB_ORDINAL_ULEB = 0x20
BIND_OPCODE_SET_DYLIB_SPECIAL_IMM
const
#
const BIND_OPCODE_SET_DYLIB_SPECIAL_IMM = 0x30
BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB
const
#
const BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB = 0x70
BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
const
#
const BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM = 0x40
BIND_OPCODE_SET_TYPE_IMM
const
#
const BIND_OPCODE_SET_TYPE_IMM = 0x50
BIND_OPCODE_THREADED
const
#
const BIND_OPCODE_THREADED = 0xD0
BIND_SPECIAL_DYLIB_FLAT_LOOKUP
const
#
const BIND_SPECIAL_DYLIB_FLAT_LOOKUP = *ast.UnaryExpr
BIND_SPECIAL_DYLIB_MAIN_EXECUTABLE
const
#
const BIND_SPECIAL_DYLIB_MAIN_EXECUTABLE = *ast.UnaryExpr
BIND_SPECIAL_DYLIB_SELF
const
#
const BIND_SPECIAL_DYLIB_SELF = 0
BIND_SPECIAL_DYLIB_WEAK_LOOKUP
const
#
const BIND_SPECIAL_DYLIB_WEAK_LOOKUP = *ast.UnaryExpr
BIND_SUBOPCODE_THREADED_APPLY
const
#
const BIND_SUBOPCODE_THREADED_APPLY = 0x01
BIND_SUBOPCODE_THREADED_SET_BIND_ORDINAL_TABLE_SIZE_ULEB
const
#
const BIND_SUBOPCODE_THREADED_SET_BIND_ORDINAL_TABLE_SIZE_ULEB = 0x00
BIND_TYPE_POINTER
const
#
const BIND_TYPE_POINTER = 1
BIND_TYPE_TEXT_ABSOLUTE32
const
#
const BIND_TYPE_TEXT_ABSOLUTE32 = 2
BIND_TYPE_TEXT_PCREL32
const
#
const BIND_TYPE_TEXT_PCREL32 = 3
BSSSym
const
#
const BSSSym SymbolType = 'B'
BuildModeCArchive
const
#
const BuildModeCArchive
BuildModeCShared
const
#
const BuildModeCShared
BuildModeExe
const
#
const BuildModeExe
BuildModePIE
const
#
const BuildModePIE
BuildModePlugin
const
#
const BuildModePlugin
BuildModeShared
const
#
const BuildModeShared
BuildModeUnset
const
#
const BuildModeUnset BuildMode = iota
C_BCOMM
const
#
const C_BCOMM = 135
C_BINCL
const
#
const C_BINCL = 108
C_BLOCK
const
#
const C_BLOCK = 100
C_BSTAT
const
#
const C_BSTAT = 143
C_DECL
const
#
const C_DECL = 140
C_DWARF
const
#
const C_DWARF = 112
C_ECOML
const
#
const C_ECOML = 136
C_ECOMM
const
#
const C_ECOMM = 137
C_EINCL
const
#
const C_EINCL = 109
C_ENTRY
const
#
const C_ENTRY = 141
C_ESTAT
const
#
const C_ESTAT = 144
C_EXT
const
#
const C_EXT = 2
C_FCN
const
#
const C_FCN = 101
C_FILE
const
#
const C_FILE = 103
C_FUN
const
#
const C_FUN = 142
C_GSYM
const
#
const C_GSYM = 128
C_GTLS
const
#
const C_GTLS = 145
C_HIDEXT
const
#
const C_HIDEXT = 107
C_LSYM
const
#
const C_LSYM = 129
C_NULL
const
#
const C_NULL = 0
C_PSYM
const
#
const C_PSYM = 130
C_RPSYM
const
#
const C_RPSYM = 132
C_RSYM
const
#
const C_RSYM = 131
C_STAT
const
#
const C_STAT = 3
C_STSYM
const
#
const C_STSYM = 133
C_STTLS
const
#
const C_STTLS = 146
C_WEAKEXT
const
#
const C_WEAKEXT = 111
CarrierSymByType
var
#
var CarrierSymByType [sym.SXREF]struct{...}
DataSym
const
#
const DataSym SymbolType = 'D'
DeletedAutoSym
const
#
const DeletedAutoSym = 'x'
ELF32HDRSIZE
const
#
const ELF32HDRSIZE = 52
ELF32PHDRSIZE
const
#
const ELF32PHDRSIZE = 32
ELF32RELSIZE
const
#
const ELF32RELSIZE = 8
ELF32SHDRSIZE
const
#
const ELF32SHDRSIZE = 40
ELF32SYMSIZE
const
#
const ELF32SYMSIZE = 16
ELF64HDRSIZE
const
#
const ELF64HDRSIZE = 64
ELF64PHDRSIZE
const
#
const ELF64PHDRSIZE = 56
ELF64RELASIZE
const
#
const ELF64RELASIZE = 24
ELF64RELSIZE
const
#
const ELF64RELSIZE = 16
ELF64SHDRSIZE
const
#
const ELF64SHDRSIZE = 64
ELF64SYMSIZE
const
#
const ELF64SYMSIZE = 24
ELFRESERVE
const
#
const ELFRESERVE = 4096
ELF_NOTE_BUILDINFO_NAME
var
#
var ELF_NOTE_BUILDINFO_NAME = *ast.CallExpr
ELF_NOTE_BUILDINFO_NAMESZ
const
#
const ELF_NOTE_BUILDINFO_NAMESZ = 4
ELF_NOTE_BUILDINFO_TAG
const
#
const ELF_NOTE_BUILDINFO_TAG = 3
ELF_NOTE_FREEBSD_ABI_TAG
const
#
const ELF_NOTE_FREEBSD_ABI_TAG = 1
ELF_NOTE_FREEBSD_DESCSZ
const
#
const ELF_NOTE_FREEBSD_DESCSZ = 4
ELF_NOTE_FREEBSD_FCTL_ASLR_DISABLE
const
#
const ELF_NOTE_FREEBSD_FCTL_ASLR_DISABLE = 0x1
ELF_NOTE_FREEBSD_FEATURE_CTL_TAG
const
#
const ELF_NOTE_FREEBSD_FEATURE_CTL_TAG = 4
ELF_NOTE_FREEBSD_NAME
const
#
const ELF_NOTE_FREEBSD_NAME = "FreeBSD\x00"
ELF_NOTE_FREEBSD_NAMESZ
const
#
const ELF_NOTE_FREEBSD_NAMESZ = 8
ELF_NOTE_FREEBSD_NOINIT_TAG
const
#
const ELF_NOTE_FREEBSD_NOINIT_TAG = 2
ELF_NOTE_FREEBSD_VERSION
const
#
const ELF_NOTE_FREEBSD_VERSION = 1203000
ELF_NOTE_GOABIHASH_TAG
const
#
const ELF_NOTE_GOABIHASH_TAG = 2
ELF_NOTE_GOBUILDID_TAG
const
#
const ELF_NOTE_GOBUILDID_TAG = 4
ELF_NOTE_GODEPS_TAG
const
#
const ELF_NOTE_GODEPS_TAG = 3
ELF_NOTE_GOPKGLIST_TAG
const
#
const ELF_NOTE_GOPKGLIST_TAG = 1
ELF_NOTE_GO_NAME
var
#
var ELF_NOTE_GO_NAME = *ast.CallExpr
ELF_NOTE_NETBSD_DESCSZ
const
#
const ELF_NOTE_NETBSD_DESCSZ = 4
ELF_NOTE_NETBSD_NAME
var
#
var ELF_NOTE_NETBSD_NAME = *ast.CallExpr
ELF_NOTE_NETBSD_NAMESZ
const
#
const ELF_NOTE_NETBSD_NAMESZ = 7
ELF_NOTE_NETBSD_TAG
const
#
const ELF_NOTE_NETBSD_TAG = 1
ELF_NOTE_NETBSD_VERSION
const
#
const ELF_NOTE_NETBSD_VERSION = 700000000
ELF_NOTE_OPENBSD_DESCSZ
const
#
const ELF_NOTE_OPENBSD_DESCSZ = 4
ELF_NOTE_OPENBSD_NAME
var
#
var ELF_NOTE_OPENBSD_NAME = *ast.CallExpr
ELF_NOTE_OPENBSD_NAMESZ
const
#
const ELF_NOTE_OPENBSD_NAMESZ = 8
ELF_NOTE_OPENBSD_TAG
const
#
const ELF_NOTE_OPENBSD_TAG = 1
ELF_NOTE_OPENBSD_VERSION
const
#
const ELF_NOTE_OPENBSD_VERSION = 0
FILHSZ_32
const
#
const FILHSZ_32 = 20
FILHSZ_64
const
#
const FILHSZ_64 = 24
F_DSA
const
#
const F_DSA = 0x0040
F_DYNLOAD
const
#
const F_DYNLOAD = 0x1000
F_EXEC
const
#
const F_EXEC = 0x0002
F_FDPR_OPTI
const
#
const F_FDPR_OPTI = 0x0020
F_FDPR_PROF
const
#
const F_FDPR_PROF = 0x0010
F_LNNO
const
#
const F_LNNO = 0x0004
F_LOADONLY
const
#
const F_LOADONLY = 0x4000
F_RELFLG
const
#
const F_RELFLG = 0x0001
F_SHROBJ
const
#
const F_SHROBJ = 0x2000
F_VARPG
const
#
const F_VARPG = 0x0100
FlagC
var
#
var FlagC = *ast.CallExpr
FlagD
var
#
var FlagD = *ast.CallExpr
FlagDebugTextSize
var
#
var FlagDebugTextSize = *ast.CallExpr
FlagDebugTramp
var
#
var FlagDebugTramp = *ast.CallExpr
FlagRound
var
#
var FlagRound = *ast.CallExpr
FlagS
var
#
var FlagS = *ast.CallExpr
FlagStrictDups
var
#
var FlagStrictDups = *ast.CallExpr
FlagTextAddr
var
#
var FlagTextAddr = *ast.CallExpr
FlagW
var
#
var FlagW = *ast.CallExpr
FrameSym
const
#
const FrameSym SymbolType = 'm'
Funcalign
var
#
var Funcalign int
GdbScriptPythonFileId
const
#
const GdbScriptPythonFileId = 1
GdbScriptPythonTextId
const
#
const GdbScriptPythonTextId = 4
GdbScriptSchemeFileId
const
#
const GdbScriptSchemeFileId = 3
GdbScriptSchemeTextId
const
#
const GdbScriptSchemeTextId = 6
HEADR
var
#
var HEADR int32
IMAGE_REL_AMD64_ADDR32
const
#
const IMAGE_REL_AMD64_ADDR32 = 0x0002
IMAGE_REL_AMD64_ADDR32NB
const
#
const IMAGE_REL_AMD64_ADDR32NB = 0x0003
IMAGE_REL_AMD64_ADDR64
const
#
const IMAGE_REL_AMD64_ADDR64 = 0x0001
IMAGE_REL_AMD64_REL32
const
#
const IMAGE_REL_AMD64_REL32 = 0x0004
IMAGE_REL_AMD64_SECREL
const
#
const IMAGE_REL_AMD64_SECREL = 0x000B
IMAGE_REL_ARM64_ABSOLUTE
const
#
const IMAGE_REL_ARM64_ABSOLUTE = 0x0000
IMAGE_REL_ARM64_ADDR32
const
#
const IMAGE_REL_ARM64_ADDR32 = 0x0001
IMAGE_REL_ARM64_ADDR32NB
const
#
const IMAGE_REL_ARM64_ADDR32NB = 0x0002
IMAGE_REL_ARM64_ADDR64
const
#
const IMAGE_REL_ARM64_ADDR64 = 0x000E
IMAGE_REL_ARM64_BRANCH14
const
#
const IMAGE_REL_ARM64_BRANCH14 = 0x0010
IMAGE_REL_ARM64_BRANCH19
const
#
const IMAGE_REL_ARM64_BRANCH19 = 0x000F
IMAGE_REL_ARM64_BRANCH26
const
#
const IMAGE_REL_ARM64_BRANCH26 = 0x0003
IMAGE_REL_ARM64_PAGEBASE_REL21
const
#
const IMAGE_REL_ARM64_PAGEBASE_REL21 = 0x0004
IMAGE_REL_ARM64_PAGEOFFSET_12A
const
#
const IMAGE_REL_ARM64_PAGEOFFSET_12A = 0x0006
IMAGE_REL_ARM64_PAGEOFFSET_12L
const
#
const IMAGE_REL_ARM64_PAGEOFFSET_12L = 0x0007
IMAGE_REL_ARM64_REL21
const
#
const IMAGE_REL_ARM64_REL21 = 0x0005
IMAGE_REL_ARM64_REL32
const
#
const IMAGE_REL_ARM64_REL32 = 0x0011
IMAGE_REL_ARM64_SECREL
const
#
const IMAGE_REL_ARM64_SECREL = 0x0008
IMAGE_REL_ARM64_SECREL_HIGH12A
const
#
const IMAGE_REL_ARM64_SECREL_HIGH12A = 0x000A
IMAGE_REL_ARM64_SECREL_LOW12A
const
#
const IMAGE_REL_ARM64_SECREL_LOW12A = 0x0009
IMAGE_REL_ARM64_SECREL_LOW12L
const
#
const IMAGE_REL_ARM64_SECREL_LOW12L = 0x000B
IMAGE_REL_ARM64_SECTION
const
#
const IMAGE_REL_ARM64_SECTION = 0x000D
IMAGE_REL_ARM64_TOKEN
const
#
const IMAGE_REL_ARM64_TOKEN = 0x000C
IMAGE_REL_ARM_ABSOLUTE
const
#
const IMAGE_REL_ARM_ABSOLUTE = 0x0000
IMAGE_REL_ARM_ADDR32
const
#
const IMAGE_REL_ARM_ADDR32 = 0x0001
IMAGE_REL_ARM_ADDR32NB
const
#
const IMAGE_REL_ARM_ADDR32NB = 0x0002
IMAGE_REL_ARM_BRANCH11
const
#
const IMAGE_REL_ARM_BRANCH11 = 0x0004
IMAGE_REL_ARM_BRANCH24
const
#
const IMAGE_REL_ARM_BRANCH24 = 0x0003
IMAGE_REL_ARM_SECREL
const
#
const IMAGE_REL_ARM_SECREL = 0x000F
IMAGE_REL_BASED_DIR64
const
#
const IMAGE_REL_BASED_DIR64 = 10
IMAGE_REL_BASED_HIGHLOW
const
#
const IMAGE_REL_BASED_HIGHLOW = 3
IMAGE_REL_I386_DIR32
const
#
const IMAGE_REL_I386_DIR32 = 0x0006
IMAGE_REL_I386_DIR32NB
const
#
const IMAGE_REL_I386_DIR32NB = 0x0007
IMAGE_REL_I386_REL32
const
#
const IMAGE_REL_I386_REL32 = 0x0014
IMAGE_REL_I386_SECREL
const
#
const IMAGE_REL_I386_SECREL = 0x000B
IMAGE_SCN_ALIGN_1024BYTES
const
#
const IMAGE_SCN_ALIGN_1024BYTES = 0x00B00000
IMAGE_SCN_ALIGN_128BYTES
const
#
const IMAGE_SCN_ALIGN_128BYTES = 0x00800000
IMAGE_SCN_ALIGN_16BYTES
const
#
const IMAGE_SCN_ALIGN_16BYTES = 0x00500000
IMAGE_SCN_ALIGN_1BYTES
const
#
const IMAGE_SCN_ALIGN_1BYTES = 0x00100000
IMAGE_SCN_ALIGN_2048BYTES
const
#
const IMAGE_SCN_ALIGN_2048BYTES = 0x00C00000
IMAGE_SCN_ALIGN_256BYTES
const
#
const IMAGE_SCN_ALIGN_256BYTES = 0x00900000
IMAGE_SCN_ALIGN_2BYTES
const
#
const IMAGE_SCN_ALIGN_2BYTES = 0x00200000
IMAGE_SCN_ALIGN_32BYTES
const
#
const IMAGE_SCN_ALIGN_32BYTES = 0x00600000
IMAGE_SCN_ALIGN_4096BYTES
const
#
const IMAGE_SCN_ALIGN_4096BYTES = 0x00D00000
IMAGE_SCN_ALIGN_4BYTES
const
#
const IMAGE_SCN_ALIGN_4BYTES = 0x00300000
IMAGE_SCN_ALIGN_512BYTES
const
#
const IMAGE_SCN_ALIGN_512BYTES = 0x00A00000
IMAGE_SCN_ALIGN_64BYTES
const
#
const IMAGE_SCN_ALIGN_64BYTES = 0x00700000
IMAGE_SCN_ALIGN_8192BYTES
const
#
const IMAGE_SCN_ALIGN_8192BYTES = 0x00E00000
IMAGE_SCN_ALIGN_8BYTES
const
#
const IMAGE_SCN_ALIGN_8BYTES = 0x00400000
IMAGE_SCN_CNT_CODE
const
#
const IMAGE_SCN_CNT_CODE = 0x00000020
IMAGE_SCN_CNT_INITIALIZED_DATA
const
#
const IMAGE_SCN_CNT_INITIALIZED_DATA = 0x00000040
IMAGE_SCN_CNT_UNINITIALIZED_DATA
const
#
const IMAGE_SCN_CNT_UNINITIALIZED_DATA = 0x00000080
IMAGE_SCN_GPREL
const
#
const IMAGE_SCN_GPREL = 0x00008000
IMAGE_SCN_LNK_COMDAT
const
#
const IMAGE_SCN_LNK_COMDAT = 0x00001000
IMAGE_SCN_LNK_INFO
const
#
const IMAGE_SCN_LNK_INFO = 0x00000200
IMAGE_SCN_LNK_NRELOC_OVFL
const
#
const IMAGE_SCN_LNK_NRELOC_OVFL = 0x01000000
IMAGE_SCN_LNK_OTHER
const
#
const IMAGE_SCN_LNK_OTHER = 0x00000100
IMAGE_SCN_LNK_REMOVE
const
#
const IMAGE_SCN_LNK_REMOVE = 0x00000800
IMAGE_SCN_MEM_16BIT
const
#
const IMAGE_SCN_MEM_16BIT = 0x00020000
IMAGE_SCN_MEM_DISCARDABLE
const
#
const IMAGE_SCN_MEM_DISCARDABLE = 0x02000000
IMAGE_SCN_MEM_EXECUTE
const
#
const IMAGE_SCN_MEM_EXECUTE = 0x20000000
IMAGE_SCN_MEM_LOCKED
const
#
const IMAGE_SCN_MEM_LOCKED = 0x00040000
IMAGE_SCN_MEM_NOT_CACHED
const
#
const IMAGE_SCN_MEM_NOT_CACHED = 0x04000000
IMAGE_SCN_MEM_NOT_PAGED
const
#
const IMAGE_SCN_MEM_NOT_PAGED = 0x08000000
IMAGE_SCN_MEM_PRELOAD
const
#
const IMAGE_SCN_MEM_PRELOAD = 0x00080000
IMAGE_SCN_MEM_PURGEABLE
const
#
const IMAGE_SCN_MEM_PURGEABLE = 0x00020000
IMAGE_SCN_MEM_READ
const
#
const IMAGE_SCN_MEM_READ = 0x40000000
IMAGE_SCN_MEM_SHARED
const
#
const IMAGE_SCN_MEM_SHARED = 0x10000000
IMAGE_SCN_MEM_WRITE
const
#
const IMAGE_SCN_MEM_WRITE = 0x80000000
IMAGE_SYM_CLASS_EXTERNAL
const
#
const IMAGE_SYM_CLASS_EXTERNAL = 2
IMAGE_SYM_CLASS_STATIC
const
#
const IMAGE_SYM_CLASS_STATIC = 3
IMAGE_SYM_DTYPE_ARRAY
const
#
const IMAGE_SYM_DTYPE_ARRAY = 3
IMAGE_SYM_DTYPE_FUNCTION
const
#
const IMAGE_SYM_DTYPE_FUNCTION = 2
IMAGE_SYM_TYPE_NULL
const
#
const IMAGE_SYM_TYPE_NULL = 0
IMAGE_SYM_TYPE_STRUCT
const
#
const IMAGE_SYM_TYPE_STRUCT = 8
INITIAL_MACHO_HEADR
const
#
const INITIAL_MACHO_HEADR = *ast.BinaryExpr
LDHDRSZ_32
const
#
const LDHDRSZ_32 = 32
LDHDRSZ_64
const
#
const LDHDRSZ_64 = 56
LDSYMSZ_64
const
#
const LDSYMSZ_64 = 24
LINE_BASE
const
#
const LINE_BASE = *ast.UnaryExpr
LINE_RANGE
const
#
const LINE_RANGE = 10
LinkAuto
const
#
const LinkAuto LinkMode = iota
LinkExternal
const
#
const LinkExternal
LinkInternal
const
#
const LinkInternal
MACHO32SYMSIZE
const
#
const MACHO32SYMSIZE = 12
MACHO64SYMSIZE
const
#
const MACHO64SYMSIZE = 16
MACHO_ARM64_RELOC_ADDEND
const
#
const MACHO_ARM64_RELOC_ADDEND = 10
MACHO_ARM64_RELOC_BRANCH26
const
#
const MACHO_ARM64_RELOC_BRANCH26 = 2
MACHO_ARM64_RELOC_GOT_LOAD_PAGE21
const
#
const MACHO_ARM64_RELOC_GOT_LOAD_PAGE21 = 5
MACHO_ARM64_RELOC_GOT_LOAD_PAGEOFF12
const
#
const MACHO_ARM64_RELOC_GOT_LOAD_PAGEOFF12 = 6
MACHO_ARM64_RELOC_PAGE21
const
#
const MACHO_ARM64_RELOC_PAGE21 = 3
MACHO_ARM64_RELOC_PAGEOFF12
const
#
const MACHO_ARM64_RELOC_PAGEOFF12 = 4
MACHO_ARM64_RELOC_UNSIGNED
const
#
const MACHO_ARM64_RELOC_UNSIGNED = 0
MACHO_ARM_RELOC_BR24
const
#
const MACHO_ARM_RELOC_BR24 = 5
MACHO_ARM_RELOC_PAIR
const
#
const MACHO_ARM_RELOC_PAIR = 1
MACHO_ARM_RELOC_SECTDIFF
const
#
const MACHO_ARM_RELOC_SECTDIFF = 2
MACHO_ARM_RELOC_VANILLA
const
#
const MACHO_ARM_RELOC_VANILLA = 0
MACHO_CPU_386
const
#
const MACHO_CPU_386 = 7
MACHO_CPU_AMD64
const
#
const MACHO_CPU_AMD64 = *ast.BinaryExpr
MACHO_CPU_ARM
const
#
const MACHO_CPU_ARM = 12
MACHO_CPU_ARM64
const
#
const MACHO_CPU_ARM64 = *ast.BinaryExpr
MACHO_FAKE_GOTPCREL
const
#
const MACHO_FAKE_GOTPCREL = 100
MACHO_GENERIC_RELOC_VANILLA
const
#
const MACHO_GENERIC_RELOC_VANILLA = 0
MACHO_SUBCPU_ARM
const
#
const MACHO_SUBCPU_ARM = 0
MACHO_SUBCPU_ARM64E
const
#
const MACHO_SUBCPU_ARM64E = 2
MACHO_SUBCPU_ARM64_ALL
const
#
const MACHO_SUBCPU_ARM64_ALL = 0
MACHO_SUBCPU_ARM64_V8
const
#
const MACHO_SUBCPU_ARM64_V8 = 1
MACHO_SUBCPU_ARMV7
const
#
const MACHO_SUBCPU_ARMV7 = 9
MACHO_SUBCPU_X86
const
#
const MACHO_SUBCPU_X86 = 3
MACHO_X86_64_RELOC_BRANCH
const
#
const MACHO_X86_64_RELOC_BRANCH = 2
MACHO_X86_64_RELOC_GOT
const
#
const MACHO_X86_64_RELOC_GOT = 4
MACHO_X86_64_RELOC_GOT_LOAD
const
#
const MACHO_X86_64_RELOC_GOT_LOAD = 3
MACHO_X86_64_RELOC_SIGNED
const
#
const MACHO_X86_64_RELOC_SIGNED = 1
MACHO_X86_64_RELOC_SIGNED_1
const
#
const MACHO_X86_64_RELOC_SIGNED_1 = 6
MACHO_X86_64_RELOC_SIGNED_2
const
#
const MACHO_X86_64_RELOC_SIGNED_2 = 7
MACHO_X86_64_RELOC_SIGNED_4
const
#
const MACHO_X86_64_RELOC_SIGNED_4 = 8
MACHO_X86_64_RELOC_SUBTRACTOR
const
#
const MACHO_X86_64_RELOC_SUBTRACTOR = 5
MACHO_X86_64_RELOC_UNSIGNED
const
#
const MACHO_X86_64_RELOC_UNSIGNED = 0
MH_DYLDLINK
const
#
const MH_DYLDLINK = 0x4
MH_EXECUTE
const
#
const MH_EXECUTE = 0x2
MH_MAGIC
const
#
const MH_MAGIC = 0xfeedface
MH_MAGIC_64
const
#
const MH_MAGIC_64 = 0xfeedfacf
MH_NOUNDEFS
const
#
const MH_NOUNDEFS = 0x1
MH_OBJECT
const
#
const MH_OBJECT = 0x1
MH_PIE
const
#
const MH_PIE = 0x200000
MIPS_FPABI_ANY
const
#
const MIPS_FPABI_ANY = 1
MIPS_FPABI_FP64
const
#
const MIPS_FPABI_FP64 = 6
MIPS_FPABI_FP64A
const
#
const MIPS_FPABI_FP64A = 7
MIPS_FPABI_FPXX
const
#
const MIPS_FPABI_FPXX = 5
MIPS_FPABI_HIST
const
#
const MIPS_FPABI_HIST = 4
MIPS_FPABI_NONE
const
#
const MIPS_FPABI_NONE = 0
MIPS_FPABI_SINGLE
const
#
const MIPS_FPABI_SINGLE = 2
MIPS_FPABI_SOFT
const
#
const MIPS_FPABI_SOFT = 3
NOIDX
const
#
const NOIDX = 0x7fffffff
NSECT
const
#
const NSECT = 400
N_ABS
const
#
const N_ABS = *ast.UnaryExpr
N_DEBUG
const
#
const N_DEBUG = *ast.UnaryExpr
N_UNDEF
const
#
const N_UNDEF = 0
Nelfsym
var
#
var Nelfsym = 1
NumSymKind
const
#
const NumSymKind
OPCODE_BASE
const
#
const OPCODE_BASE = 11
PC_RANGE
const
#
const PC_RANGE = *ast.BinaryExpr
PEBASE
var
#
var PEBASE int64
PEFILEALIGN
var
#
var PEFILEALIGN int64 = *ast.BinaryExpr
PEFILEHEADR
var
#
var PEFILEHEADR int32
PESECTALIGN
var
#
var PESECTALIGN int64 = 0x1000
PESECTHEADR
var
#
var PESECTHEADR int32
PLATFORM_BRIDGEOS
const
#
const PLATFORM_BRIDGEOS MachoPlatform = 5
PLATFORM_IOS
const
#
const PLATFORM_IOS MachoPlatform = 2
PLATFORM_MACCATALYST
const
#
const PLATFORM_MACCATALYST MachoPlatform = 6
PLATFORM_MACOS
const
#
const PLATFORM_MACOS MachoPlatform = 1
PLATFORM_TVOS
const
#
const PLATFORM_TVOS MachoPlatform = 3
PLATFORM_WATCHOS
const
#
const PLATFORM_WATCHOS MachoPlatform = 4
ParamSym
const
#
const ParamSym SymbolType = 'p'
PeMinimumTargetMajorVersion
const
#
const PeMinimumTargetMajorVersion = 6
PeMinimumTargetMinorVersion
const
#
const PeMinimumTargetMinorVersion = 1
REBASE_IMMEDIATE_MASK
const
#
const REBASE_IMMEDIATE_MASK = 0x0F
REBASE_OPCODE_ADD_ADDR_IMM_SCALED
const
#
const REBASE_OPCODE_ADD_ADDR_IMM_SCALED = 0x40
REBASE_OPCODE_ADD_ADDR_ULEB
const
#
const REBASE_OPCODE_ADD_ADDR_ULEB = 0x30
REBASE_OPCODE_DONE
const
#
const REBASE_OPCODE_DONE = 0x00
REBASE_OPCODE_DO_REBASE_ADD_ADDR_ULEB
const
#
const REBASE_OPCODE_DO_REBASE_ADD_ADDR_ULEB = 0x70
REBASE_OPCODE_DO_REBASE_IMM_TIMES
const
#
const REBASE_OPCODE_DO_REBASE_IMM_TIMES = 0x50
REBASE_OPCODE_DO_REBASE_ULEB_TIMES
const
#
const REBASE_OPCODE_DO_REBASE_ULEB_TIMES = 0x60
REBASE_OPCODE_DO_REBASE_ULEB_TIMES_SKIPPING_ULEB
const
#
const REBASE_OPCODE_DO_REBASE_ULEB_TIMES_SKIPPING_ULEB = 0x80
REBASE_OPCODE_MASK
const
#
const REBASE_OPCODE_MASK = 0xF0
REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB
const
#
const REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB = 0x20
REBASE_OPCODE_SET_TYPE_IMM
const
#
const REBASE_OPCODE_SET_TYPE_IMM = 0x10
REBASE_TYPE_POINTER
const
#
const REBASE_TYPE_POINTER = 1
REBASE_TYPE_TEXT_ABSOLUTE32
const
#
const REBASE_TYPE_TEXT_ABSOLUTE32 = 2
REBASE_TYPE_TEXT_PCREL32
const
#
const REBASE_TYPE_TEXT_PCREL32 = 3
RELSZ_64
const
#
const RELSZ_64 = 14
SARMAG
const
#
const SARMAG = 8
SAR_HDR
const
#
const SAR_HDR = *ast.BinaryExpr
SCNHSZ_32
const
#
const SCNHSZ_32 = 40
SCNHSZ_64
const
#
const SCNHSZ_64 = 72
SSUBTYP_DWABREV
const
#
const SSUBTYP_DWABREV = 0x60000
SSUBTYP_DWARNGE
const
#
const SSUBTYP_DWARNGE = 0x50000
SSUBTYP_DWFRAME
const
#
const SSUBTYP_DWFRAME = 0xA0000
SSUBTYP_DWINFO
const
#
const SSUBTYP_DWINFO = 0x10000
SSUBTYP_DWLINE
const
#
const SSUBTYP_DWLINE = 0x20000
SSUBTYP_DWLOC
const
#
const SSUBTYP_DWLOC = 0x90000
SSUBTYP_DWMAC
const
#
const SSUBTYP_DWMAC = 0xB0000
SSUBTYP_DWPBNMS
const
#
const SSUBTYP_DWPBNMS = 0x30000
SSUBTYP_DWPBTYP
const
#
const SSUBTYP_DWPBTYP = 0x40000
SSUBTYP_DWRNGES
const
#
const SSUBTYP_DWRNGES = 0x80000
SSUBTYP_DWSTR
const
#
const SSUBTYP_DWSTR = 0x70000
STYP_BSS
const
#
const STYP_BSS = 0x0080
STYP_DATA
const
#
const STYP_DATA = 0x0040
STYP_DEBUG
const
#
const STYP_DEBUG = 0x2000
STYP_DWARF
const
#
const STYP_DWARF = 0x0010
STYP_EXCEPT
const
#
const STYP_EXCEPT = 0x0100
STYP_INFO
const
#
const STYP_INFO = 0x0200
STYP_LOADER
const
#
const STYP_LOADER = 0x1000
STYP_OVRFLO
const
#
const STYP_OVRFLO = 0x8000
STYP_TBSS
const
#
const STYP_TBSS = 0x0800
STYP_TDATA
const
#
const STYP_TDATA = 0x0400
STYP_TEXT
const
#
const STYP_TEXT = 0x0020
STYP_TYPCHK
const
#
const STYP_TYPCHK = 0x4000
SUBBUCKETS
const
#
const SUBBUCKETS = 16
SUBBUCKETSIZE
const
#
const SUBBUCKETSIZE = *ast.BinaryExpr
SYMESZ
const
#
const SYMESZ = 18
SYM_TYPE_FUNC
const
#
const SYM_TYPE_FUNC = 0x0020
SYM_V_EXPORTED
const
#
const SYM_V_EXPORTED = 0x4000
SYM_V_HIDDEN
const
#
const SYM_V_HIDDEN = 0x2000
SYM_V_INTERNAL
const
#
const SYM_V_INTERNAL = 0x1000
SYM_V_PROTECTED
const
#
const SYM_V_PROTECTED = 0x3000
S_ATTR_DEBUG
const
#
const S_ATTR_DEBUG = 0x02000000
S_ATTR_PURE_INSTRUCTIONS
const
#
const S_ATTR_PURE_INSTRUCTIONS = 0x80000000
S_ATTR_SOME_INSTRUCTIONS
const
#
const S_ATTR_SOME_INSTRUCTIONS = 0x00000400
S_MOD_INIT_FUNC_POINTERS
const
#
const S_MOD_INIT_FUNC_POINTERS = 0x9
S_NON_LAZY_SYMBOL_POINTERS
const
#
const S_NON_LAZY_SYMBOL_POINTERS = 0x6
S_REGULAR
const
#
const S_REGULAR = 0x0
S_SYMBOL_STUBS
const
#
const S_SYMBOL_STUBS = 0x8
S_ZEROFILL
const
#
const S_ZEROFILL = 0x1
Segdata
var
#
var Segdata sym.Segment
Segdwarf
var
#
var Segdwarf sym.Segment
Segments
var
#
var Segments = []*sym.Segment{...}
Segpdata
var
#
var Segpdata sym.Segment
Segrelrodata
var
#
var Segrelrodata sym.Segment
Segrodata
var
#
var Segrodata sym.Segment
Segtext
var
#
var Segtext sym.Segment
Segxdata
var
#
var Segxdata sym.Segment
SymKindExtdef
const
#
const SymKindExtdef
SymKindLocal
const
#
const SymKindLocal = *ast.BinaryExpr
SymKindUndef
const
#
const SymKindUndef
TLSSym
const
#
const TLSSym SymbolType = 't'
TextSym
const
#
const TextSym SymbolType = 'T'
U64_TOCMAGIC
const
#
const U64_TOCMAGIC = 0767
UndefinedSym
const
#
const UndefinedSym SymbolType = 'U'
XCOFFDATABASE
const
#
const XCOFFDATABASE = 0x200000000
XCOFFHDRRESERVE
const
#
const XCOFFHDRRESERVE = *ast.BinaryExpr
XCOFFSECTALIGN
const
#
const XCOFFSECTALIGN int64 = 64
XCOFFTEXTBASE
const
#
const XCOFFTEXTBASE = 0x100000000
XCOFF_R_BA
const
#
const XCOFF_R_BA = 0x08
XCOFF_R_BR
const
#
const XCOFF_R_BR = 0x0A
XCOFF_R_GL
const
#
const XCOFF_R_GL = 0x05
XCOFF_R_NEG
const
#
const XCOFF_R_NEG = 0x01
XCOFF_R_POS
const
#
const XCOFF_R_POS = 0x00
XCOFF_R_RBA
const
#
const XCOFF_R_RBA = 0x18
XCOFF_R_RBR
const
#
const XCOFF_R_RBR = 0x1A
XCOFF_R_REF
const
#
const XCOFF_R_REF = 0x0F
XCOFF_R_REL
const
#
const XCOFF_R_REL = 0x02
XCOFF_R_RL
const
#
const XCOFF_R_RL = 0x0C
XCOFF_R_RLA
const
#
const XCOFF_R_RLA = 0x0D
XCOFF_R_TCL
const
#
const XCOFF_R_TCL = 0x06
XCOFF_R_TLS
const
#
const XCOFF_R_TLS = 0x20
XCOFF_R_TLSM
const
#
const XCOFF_R_TLSM = 0x24
XCOFF_R_TLSML
const
#
const XCOFF_R_TLSML = 0x25
XCOFF_R_TLS_IE
const
#
const XCOFF_R_TLS_IE = 0x21
XCOFF_R_TLS_LD
const
#
const XCOFF_R_TLS_LD = 0x22
XCOFF_R_TLS_LE
const
#
const XCOFF_R_TLS_LE = 0x23
XCOFF_R_TOC
const
#
const XCOFF_R_TOC = 0x03
XCOFF_R_TOCL
const
#
const XCOFF_R_TOCL = 0x31
XCOFF_R_TOCU
const
#
const XCOFF_R_TOCU = 0x30
XCOFF_R_TRL
const
#
const XCOFF_R_TRL = 0x12
XCOFF_R_TRLA
const
#
const XCOFF_R_TRLA = 0x13
XFT_CD
const
#
const XFT_CD = 128
XFT_CT
const
#
const XFT_CT = 1
XFT_CV
const
#
const XFT_CV = 2
XFT_FN
const
#
const XFT_FN = 0
XMC_BS
const
#
const XMC_BS = 9
XMC_DB
const
#
const XMC_DB = 2
XMC_DS
const
#
const XMC_DS = 10
XMC_GL
const
#
const XMC_GL = 6
XMC_PR
const
#
const XMC_PR = 0
XMC_RO
const
#
const XMC_RO = 1
XMC_RW
const
#
const XMC_RW = 5
XMC_SV
const
#
const XMC_SV = 8
XMC_SV3264
const
#
const XMC_SV3264 = 18
XMC_SV64
const
#
const XMC_SV64 = 17
XMC_TC
const
#
const XMC_TC = 3
XMC_TC0
const
#
const XMC_TC0 = 15
XMC_TD
const
#
const XMC_TD = 16
XMC_TE
const
#
const XMC_TE = 22
XMC_TL
const
#
const XMC_TL = 20
XMC_UA
const
#
const XMC_UA = 4
XMC_UC
const
#
const XMC_UC = 11
XMC_UL
const
#
const XMC_UL = 21
XMC_XO
const
#
const XMC_XO = 7
XTY_CM
const
#
const XTY_CM = 3
XTY_ENT
const
#
const XTY_ENT = 0x20
XTY_ER
const
#
const XTY_ER = 0
XTY_EXP
const
#
const XTY_EXP = 0x10
XTY_IMP
const
#
const XTY_IMP = 0x40
XTY_LD
const
#
const XTY_LD = 2
XTY_SD
const
#
const XTY_SD = 1
XTY_WK
const
#
const XTY_WK = 0x8
_
const
#
const _ markKind = iota
_
var
#
var _ = fmt.Print
_AUX_CSECT
const
#
const _AUX_CSECT = 251
_AUX_EXCEPT
const
#
const _AUX_EXCEPT = 255
_AUX_FCN
const
#
const _AUX_FCN = 254
_AUX_FILE
const
#
const _AUX_FILE = 252
_AUX_SECT
const
#
const _AUX_SECT = 250
_AUX_SYM
const
#
const _AUX_SYM = 253
abiInternalVer
var
#
var abiInternalVer = sym.SymVerABIInternal
atExitFuncs
var
#
var atExitFuncs []func()
benchmarkFileFlag
var
#
var benchmarkFileFlag = *ast.CallExpr
benchmarkFlag
var
#
var benchmarkFlag = *ast.CallExpr
blockSize
const
#
const blockSize = *ast.BinaryExpr
buildinfo
var
#
var buildinfo []byte
checkStrictDups
var
#
var checkStrictDups int
covCounterDataLen
var
#
var covCounterDataLen uint64
covCounterDataStartOff
var
#
var covCounterDataStartOff uint64
cpuprofile
var
#
var cpuprofile = *ast.CallExpr
createTrivialCOnce
var
#
var createTrivialCOnce sync.Once
currDwscnoff
var
#
var currDwscnoff = *ast.CallExpr
currSymSrcFile
var
#
var currSymSrcFile xcoffSymSrcFile
cutoff
const
#
const cutoff = 2e9
dataAlignmentFactor
const
#
const dataAlignmentFactor = *ast.UnaryExpr
debugGCProg
const
#
const debugGCProg = false
debug_s
var
#
var debug_s bool
dexport
var
#
var dexport []loader.Sym
dosstub
var
#
var dosstub = []uint8{...}
dr
var
#
var dr *Dll
dwarfp
var
#
var dwarfp []dwarfSecInfo
dwsectCUSize
var
#
var dwsectCUSize map[string]uint64
dwsectCUSizeMu
var
#
var dwsectCUSizeMu sync.Mutex
dwtypes
var
#
var dwtypes dwarf.DWDie
dylib
var
#
var dylib []string
dynimportfail
var
#
var dynimportfail []string
dynlib
var
#
var dynlib []string
ehdr
var
#
var ehdr ElfEhdr
elf64
var
#
var elf64 bool
elfRelType
var
#
var elfRelType string
elfglobalsymndx
var
#
var elfglobalsymndx int
elfshstrdat
var
#
var elfshstrdat []byte
elfstr
var
#
var elfstr [100]Elfstring
elfstrdat
var
#
var elfstrdat []byte
elfverneed
var
#
var elfverneed int
enableFIPS
const
#
const enableFIPS = true
errNoFallocate
var
#
var errNoFallocate = *ast.CallExpr
externalobj
var
#
var externalobj = false
fipsMagic
const
#
const fipsMagic = "\xff Go fipsinfo \xff\x00"
fipsMagicLen
const
#
const fipsMagicLen = 16
fipsSumLen
const
#
const fipsSumLen = 32
fipsSyms
var
#
var fipsSyms = []struct{...}{...}
fipsinfo
var
#
var fipsinfo loader.Sym
flag8
var
#
var flag8 bool
flagA
var
#
var flagA = *ast.CallExpr
flagAsan
var
#
var flagAsan = *ast.CallExpr
flagAslr
var
#
var flagAslr = *ast.CallExpr
flagBindNow
var
#
var flagBindNow = *ast.CallExpr
flagBuildid
var
#
var flagBuildid = *ast.CallExpr
flagCaptureHostObjs
var
#
var flagCaptureHostObjs = *ast.CallExpr
flagCheckLinkname
var
#
var flagCheckLinkname = *ast.CallExpr
flagDebugNosplit
var
#
var flagDebugNosplit = *ast.CallExpr
flagDumpDep
var
#
var flagDumpDep = *ast.CallExpr
flagEntrySymbol
var
#
var flagEntrySymbol = *ast.CallExpr
flagExtar
var
#
var flagExtar = *ast.CallExpr
flagExtld
var
#
var flagExtld quoted.Flag
flagExtldflags
var
#
var flagExtldflags quoted.Flag
flagF
var
#
var flagF = *ast.CallExpr
flagFieldTrack
var
#
var flagFieldTrack = *ast.CallExpr
flagFipso
var
#
var flagFipso = *ast.CallExpr
flagG
var
#
var flagG = *ast.CallExpr
flagH
var
#
var flagH = *ast.CallExpr
flagHostBuildid
var
#
var flagHostBuildid = *ast.CallExpr
flagInstallSuffix
var
#
var flagInstallSuffix = *ast.CallExpr
flagInterpreter
var
#
var flagInterpreter = *ast.CallExpr
flagLibGCC
var
#
var flagLibGCC = *ast.CallExpr
flagMsan
var
#
var flagMsan = *ast.CallExpr
flagN
var
#
var flagN = *ast.CallExpr
flagOutfile
var
#
var flagOutfile = *ast.CallExpr
flagPluginPath
var
#
var flagPluginPath = *ast.CallExpr
flagPruneWeakMap
var
#
var flagPruneWeakMap = *ast.CallExpr
flagRace
var
#
var flagRace = *ast.CallExpr
flagRandLayout
var
#
var flagRandLayout = *ast.CallExpr
flagTmpdir
var
#
var flagTmpdir = *ast.CallExpr
flagW
var
#
var flagW ternaryFlag
funcSize
const
#
const funcSize = *ast.BinaryExpr
gdbscript
var
#
var gdbscript string
havedynamic
var
#
var havedynamic int
hostobj
var
#
var hostobj []Hostobj
hostobjcounter
var
#
var hostobjcounter int
internalpkg
var
#
var internalpkg = []string{...}
interp
var
#
var interp string
interpreter
var
#
var interpreter string
isLabel
var
#
var isLabel = *ast.CallExpr
iscgo
var
#
var iscgo bool
lcSize
var
#
var lcSize int32
ldflag
var
#
var ldflag []string
linkoff
var
#
var linkoff int64
liveness
var
#
var liveness int64
load
var
#
var load []MachoLoad
loadBudget
var
#
var loadBudget = *ast.BinaryExpr
machoPlatform
var
#
var machoPlatform MachoPlatform
machobind
var
#
var machobind []machoBindRecord
machohdr
var
#
var machohdr MachoHdr
machorebase
var
#
var machorebase []machoRebaseRecord
maxOutBufHeapLen
const
#
const maxOutBufHeapLen = *ast.BinaryExpr
memprofile
var
#
var memprofile = *ast.CallExpr
memprofilerate
var
#
var memprofilerate = *ast.CallExpr
ndebug
var
#
var ndebug int
nelfstr
var
#
var nelfstr int
nerrors
var
#
var nerrors int
nkind
var
#
var nkind [NumSymKind]int
nsect
var
#
var nsect int
nseg
var
#
var nseg int
nsortsym
var
#
var nsortsym int
outbufMode
const
#
const outbufMode = 0775
outerSymSize
var
#
var outerSymSize = *ast.CallExpr
ownTmpDir
var
#
var ownTmpDir bool
pe64
var
#
var pe64 int
pefile
var
#
var pefile peFile
phdr
var
#
var phdr [NSECT]*ElfPhdr
pkgdef
const
#
const pkgdef = "__.PKGDEF"
pkglistfornote
var
#
var pkglistfornote []byte
preferlinkext
var
#
var preferlinkext []string
prototypedies
var
#
var prototypedies map[string]*dwarf.DWDie
rpath
var
#
var rpath Rpath
rsrcsyms
var
#
var rsrcsyms []loader.Sym
seenlib
var
#
var seenlib = *ast.CallExpr
seg
var
#
var seg [16]MachoSeg
sehp
var
#
var sehp struct{...}
shdr
var
#
var shdr [NSECT]*ElfShdr
sortsym
var
#
var sortsym []loader.Sym
spSize
var
#
var spSize int32
stackCheckCycle
const
#
const stackCheckCycle int16 = *ast.BinaryExpr
stackCheckIndirect
const
#
const stackCheckIndirect loader.Sym = *ast.UnaryExpr
strdata
var
#
var strdata = *ast.CallExpr
strictDupMsgCount
var
#
var strictDupMsgCount int
strnames
var
#
var strnames []string
symSize
var
#
var symSize int32
syscallExecSupported
const
#
const syscallExecSupported = true
syscallExecSupported
const
#
const syscallExecSupported = false
ternaryFlagFalse
const
#
const ternaryFlagFalse
ternaryFlagTrue
const
#
const ternaryFlagTrue
ternaryFlagUnset
const
#
const ternaryFlagUnset ternaryFlag = iota
thearch
var
#
var thearch Arch
theline
var
#
var theline string
unknownObjFormat
var
#
var unknownObjFormat = false
viewCloseError
var
#
var viewCloseError = *ast.CallExpr
viewError
var
#
var viewError = *ast.CallExpr
visited
const
#
const visited
visiting
const
#
const visiting
wantHdr
var
#
var wantHdr = *ast.CallExpr
wasmMinDataAddr
const
#
const wasmMinDataAddr = *ast.BinaryExpr
windowsgui
var
#
var windowsgui bool
xfile
var
#
var xfile xcoffFile
zeros
var
#
var zeros [512]byte
Functions
AddAddress
method
#
func (c dwctxt) AddAddress(s dwarf.Sym, data interface{}, value int64)
AddBytes
method
#
func (c dwctxt) AddBytes(s dwarf.Sym, b []byte)
AddCURelativeAddress
method
#
func (c dwctxt) AddCURelativeAddress(s dwarf.Sym, data interface{}, value int64)
AddDWARFAddrSectionOffset
method
#
func (c dwctxt) AddDWARFAddrSectionOffset(s dwarf.Sym, t interface{}, ofs int64)
AddGotSym
function
#
func AddGotSym(target *Target, ldr *loader.Loader, syms *ArchSyms, s loader.Sym, elfRelocTyp uint32)
AddInt
method
#
func (c dwctxt) AddInt(s dwarf.Sym, size int, i int64)
AddMachoSym
function
#
AddMachoSym adds s to Mach-O symbol table, used in GenSymLate.
Currently only used on ARM64 when external linking.
func AddMachoSym(ldr *loader.Loader, s loader.Sym)
AddPELabelSym
function
#
func AddPELabelSym(ldr *loader.Loader, s loader.Sym)
AddSectionOffset
method
#
func (c dwctxt) AddSectionOffset(s dwarf.Sym, size int, t interface{}, ofs int64)
AddString
method
#
func (c dwctxt) AddString(s dwarf.Sym, v string)
AddSym
method
#
func (p *GCProg) AddSym(s loader.Sym)
AddTramp
method
#
add a trampoline with symbol s (to be laid down after the current function)
func (ctxt *Link) AddTramp(s *loader.SymbolBuilder, typ sym.SymKind)
AddType
method
#
Add to the gc program the ptr bits for the type typ at
byte offset off in the region being described.
The type must have a pointer in it.
func (p *GCProg) AddType(off int64, typ loader.Sym)
Adddynsym
function
#
func Adddynsym(ldr *loader.Loader, target *Target, syms *ArchSyms, s loader.Sym)
Asmbelfsetup
function
#
func Asmbelfsetup()
AtExit
function
#
func AtExit(f func())
CanUsePlugins
method
#
func (t *Target) CanUsePlugins() bool
CanUsePlugins
method
#
CanUsePlugins reports whether a plugins can be used
func (ctxt *Link) CanUsePlugins() bool
Close
method
#
Close closes the fipsObj. In particular it closes the output
object file specified by fipso in the call to [newFipsObj].
func (f *fipsObj) Close() error
Close
method
#
func (out *OutBuf) Close() error
CodeblkPad
function
#
func CodeblkPad(ctxt *Link, out *OutBuf, addr int64, size int64, pad []byte)
CurrentOffset
method
#
func (c dwctxt) CurrentOffset(s dwarf.Sym) int64
Data
method
#
Data returns the whole written OutBuf as a byte slice.
func (out *OutBuf) Data() []byte
DatblkBytes
function
#
Used only on Wasm for now.
func DatblkBytes(ctxt *Link, addr int64, size int64) []byte
DynlinkingGo
method
#
DynlinkingGo reports whether we are producing Go code that can live
in separate shared libraries linked together at runtime.
func (ctxt *Link) DynlinkingGo() bool
ElfSymForReloc
function
#
func ElfSymForReloc(ctxt *Link, s loader.Sym) int32
Elfinit
function
#
Initialize the global variable that describes the ELF header. It will be updated as
we write section and prog headers.
func Elfinit(ctxt *Link)
Elfwritedynent
function
#
func Elfwritedynent(arch *sys.Arch, s *loader.SymbolBuilder, tag elf.DynTag, val uint64)
Elfwritedynentsymplus
function
#
func Elfwritedynentsymplus(ctxt *Link, s *loader.SymbolBuilder, tag elf.DynTag, t loader.Sym, add int64)
End
method
#
func (p *GCProg) End(size int64)
Entryvalue
function
#
func Entryvalue(ctxt *Link) int64
ErrorClose
method
#
ErrorClose closes the output file (if any).
It is supposed to be called only at exit on error, so it doesn't do
any clean up or buffer flushing, just closes the file.
func (out *OutBuf) ErrorClose()
Errorf
function
#
Errorf logs an error message without a specific symbol for context.
Use ctxt.Errorf when possible.
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 Errorf(format string, args ...interface{})
Errorf
method
#
Errorf method 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 (ctxt *Link) Errorf(s loader.Sym, format string, args ...interface{})
Exit
function
#
Exit exits with code after executing all atExitFuncs.
func Exit(code int)
Exitf
function
#
Exitf logs an error message then calls Exit(2).
func Exitf(format string, a ...interface{})
ExtrelocSimple
function
#
ExtrelocSimple creates a simple external relocation from r, with the same
symbol and addend.
func ExtrelocSimple(ldr *loader.Loader, r loader.Reloc) loader.ExtReloc
ExtrelocViaOuterSym
function
#
ExtrelocViaOuterSym creates an external relocation from r targeting the
outer symbol and folding the subsymbol's offset into the addend.
func ExtrelocViaOuterSym(ldr *loader.Loader, r loader.Reloc, s loader.Sym) loader.ExtReloc
FoldSubSymbolOffset
function
#
FoldSubSymbolOffset computes the offset of symbol s to its top-level outer
symbol. Returns the top-level symbol and the offset.
This is used in generating external relocations.
func FoldSubSymbolOffset(ldr *loader.Loader, s loader.Sym) (loader.Sym, int64)
IncVersion
method
#
Allocate a new version (i.e. symbol namespace).
func (ctxt *Link) IncVersion() int
Init
method
#
func (p *GCProg) Init(ctxt *Link, name string)
Is386
method
#
func (t *Target) Is386() bool
IsAIX
method
#
func (t *Target) IsAIX() bool
IsAMD64
method
#
func (t *Target) IsAMD64() bool
IsARM
method
#
func (t *Target) IsARM() bool
IsARM64
method
#
func (t *Target) IsARM64() bool
IsBigEndian
method
#
func (t *Target) IsBigEndian() bool
IsBoolFlag
method
#
func (t *ternaryFlag) IsBoolFlag() bool
IsDarwin
method
#
func (t *Target) IsDarwin() bool
IsDynlinkingGo
method
#
func (t *Target) IsDynlinkingGo() bool
IsElf
method
#
func (t *Target) IsElf() bool
IsExe
method
#
func (t *Target) IsExe() bool
IsExternal
method
#
func (t *Target) IsExternal() bool
IsFreebsd
method
#
func (t *Target) IsFreebsd() bool
IsInternal
method
#
func (t *Target) IsInternal() bool
IsLOONG64
method
#
func (t *Target) IsLOONG64() bool
IsLinux
method
#
func (t *Target) IsLinux() bool
IsMIPS
method
#
func (t *Target) IsMIPS() bool
IsMIPS64
method
#
func (t *Target) IsMIPS64() bool
IsNetbsd
method
#
func (t *Target) IsNetbsd() bool
IsOpenbsd
method
#
func (t *Target) IsOpenbsd() bool
IsPIE
method
#
func (t *Target) IsPIE() bool
IsPPC64
method
#
func (t *Target) IsPPC64() bool
IsPlan9
method
#
func (t *Target) IsPlan9() bool
IsPlugin
method
#
func (t *Target) IsPlugin() bool
IsRISCV64
method
#
func (t *Target) IsRISCV64() bool
IsS390X
method
#
func (t *Target) IsS390X() bool
IsShared
method
#
func (t *Target) IsShared() bool
IsSharedGoLink
method
#
func (t *Target) IsSharedGoLink() bool
IsSolaris
method
#
func (t *Target) IsSolaris() bool
IsWasm
method
#
func (t *Target) IsWasm() bool
IsWindows
method
#
func (t *Target) IsWindows() bool
Len
method
#
func (s shlibRelocs) Len() int
Less
method
#
func (s shlibRelocs) Less(i int, j int) bool
Lflag
function
#
func Lflag(ctxt *Link, arg string)
Loaderblk
function
#
Create loader section and returns its size.
func Loaderblk(ctxt *Link, off uint64)
Logf
method
#
func (c dwctxt) Logf(format string, args ...interface{})
Logf
method
#
func (ctxt *Link) Logf(format string, args ...interface{})
MachoAddBind
function
#
func MachoAddBind(off int64, targ loader.Sym)
MachoAddRebase
function
#
func MachoAddRebase(s loader.Sym, off int64)
Main
function
#
Main is the main entry point for the linker code.
func Main(arch *sys.Arch, theArch Arch)
MaxVersion
method
#
returns the maximum version number
func (ctxt *Link) MaxVersion() int
Mmap
method
#
Mmap maps the output file with the given size. It unmaps the old mapping
if it is already mapped. It also flushes any in-heap data to the new
mapping.
func (out *OutBuf) Mmap(filesize uint64) (err error)
Mmap
method
#
Mmap allocates an in-heap output buffer with the given size. It copies
any old data (if any) to the new buffer.
func (out *OutBuf) Mmap(filesize uint64) error
Mmap
method
#
Mmap maps the output file with the given size. It unmaps the old mapping
if it is already mapped. It also flushes any in-heap data to the new
mapping.
func (out *OutBuf) Mmap(filesize uint64) error
NeedCodeSign
method
#
NeedCodeSign reports whether we need to code-sign the output binary.
func (ctxt *Link) NeedCodeSign() bool
NewOutBuf
function
#
func NewOutBuf(arch *sys.Arch) *OutBuf
Offset
method
#
func (out *OutBuf) Offset() int64
Open
method
#
func (out *OutBuf) Open(name string) error
Peinit
function
#
func Peinit(ctxt *Link)
PrepareAddmoduledata
function
#
PrepareAddmoduledata returns a symbol builder that target-specific
code can use to build up the linker-generated go.link.addmoduledata
function, along with the sym for runtime.addmoduledata itself. If
this function is not needed (for example in cases where we're
linking a module that contains the runtime) the returned builder
will be nil.
func PrepareAddmoduledata(ctxt *Link) (*loader.SymbolBuilder, loader.Sym)
PtrSize
method
#
func (c dwctxt) PtrSize() int
RecordChildDieOffsets
method
#
func (c dwctxt) RecordChildDieOffsets(s dwarf.Sym, vars []*dwarf.Var, offsets []int32)
RecordDclReference
method
#
func (c dwctxt) RecordDclReference(s dwarf.Sym, t dwarf.Sym, dclIdx int, inlIndex int)
Rnd
function
#
func Rnd(v int64, r int64) int64
SeekSet
method
#
func (out *OutBuf) SeekSet(p int64)
Set
method
#
func (r *Rpath) Set(val string) error
Set
method
#
func (mode *LinkMode) Set(s string) error
Set
method
#
func (t *ternaryFlag) Set(s string) error
Set
method
#
Set implements flag.Value to set the build mode based on the argument
to the -buildmode flag.
func (mode *BuildMode) Set(s string) error
Size
method
#
func (c dwctxt) Size(s dwarf.Sym) int64
String
method
#
func (mode *LinkMode) String() string
String
method
#
func (t *ternaryFlag) String() string
String
method
#
func (mode BuildMode) String() string
String
method
#
func (r *Rpath) String() string
Swap
method
#
func (s shlibRelocs) Swap(i int, j int)
UseRelro
method
#
UseRelro reports whether to make use of "read only relocations" aka
relro.
func (t *Target) UseRelro() bool
UsesLibc
method
#
func (t *Target) UsesLibc() bool
View
method
#
func (out *OutBuf) View(start uint64) (*OutBuf, error)
Write
method
#
Write writes the contents of v to the buffer.
func (out *OutBuf) Write(v []byte) (int, error)
Write16
method
#
func (out *OutBuf) Write16(v uint16)
Write32
method
#
func (out *OutBuf) Write32(v uint32)
Write32b
method
#
func (out *OutBuf) Write32b(v uint32)
Write64
method
#
func (out *OutBuf) Write64(v uint64)
Write64b
method
#
func (out *OutBuf) Write64b(v uint64)
Write8
method
#
func (out *OutBuf) Write8(v uint8)
WriteByte
method
#
WriteByte is an alias for Write8 to fulfill the io.ByteWriter interface.
func (out *OutBuf) WriteByte(v byte) error
WriteString
method
#
func (out *OutBuf) WriteString(s string)
WriteStringN
method
#
WriteStringN writes the first n bytes of s.
If n is larger than len(s) then it is padded with zero bytes.
func (out *OutBuf) WriteStringN(s string, n int)
WriteStringPad
method
#
WriteStringPad writes the first n bytes of s.
If n is larger than len(s) then it is padded with the bytes in pad (repeated as needed).
func (out *OutBuf) WriteStringPad(s string, n int, pad []byte)
WriteSym
method
#
WriteSym writes the content of a Symbol, and returns the output buffer
that we just wrote, so we can apply further edit to the symbol content.
For generator symbols, it also sets the symbol's Data to the output
buffer.
func (out *OutBuf) WriteSym(ldr *loader.Loader, s loader.Sym) []byte
Xcoffadddynrel
function
#
Xcoffadddynrel adds a dynamic relocation in a XCOFF file.
This relocation will be made by the loader.
func Xcoffadddynrel(target *Target, ldr *loader.Loader, syms *ArchSyms, s loader.Sym, r loader.Reloc, rIdx int) bool
Xcoffinit
function
#
Xcoffinit initialised some internal value and setups
already known header information.
func Xcoffinit(ctxt *Link)
add
method
#
add adds string str to string table t.
func (t *peStringTable) add(str string) int
add
method
#
add adds string str to string table t.
func (t *xcoffStringTable) add(str string) int
addDWARF
method
#
addDWARF adds DWARF information to the COFF file f.
func (f *peFile) addDWARF()
addDWARFSection
method
#
addDWARFSection adds DWARF section to the COFF file f.
This function is similar to addSection, but DWARF section names are
longer than 8 characters, so they need to be stored in the string table.
func (f *peFile) addDWARFSection(name string, size int) *peSection
addDwarfAddrField
method
#
addDwarfAddrField adds a DWARF field in DWARF 64bits or 32bits.
func (d *dwctxt) addDwarfAddrField(sb *loader.SymbolBuilder, v uint64)
addDwarfAddrRef
method
#
addDwarfAddrRef adds a DWARF pointer in DWARF 64bits or 32bits.
func (d *dwctxt) addDwarfAddrRef(sb *loader.SymbolBuilder, t loader.Sym)
addDwarfSection
method
#
addDwarfSection adds a dwarf section to the XCOFF file f.
This function is similar to addSection, but Dwarf section names
must be modified to conventional names and they are various subtypes.
func (f *xcoffFile) addDwarfSection(s *sym.Section) *XcoffScnHdr64
addDwsectCUSize
function
#
func addDwsectCUSize(sname string, pkgname string, size uint64)
addGeneratedSym
method
#
addGeneratedSym adds a generator symbol to pclntab, returning the new Sym.
It is the caller's responsibility to save the symbol in state.
func (state *pclntab) addGeneratedSym(ctxt *Link, name string, size int64, f generatorFunc) loader.Sym
addImports
function
#
func addImports(ctxt *Link, l *sym.Library, pn string)
addInitArray
method
#
addInitArray adds .ctors COFF section to the file f.
func (f *peFile) addInitArray(ctxt *Link) *peSection
addPEBaseReloc
function
#
func addPEBaseReloc(ctxt *Link)
addPEBaseRelocSym
function
#
func addPEBaseRelocSym(ldr *loader.Loader, s loader.Sym, rt *peBaseRelocTable)
addSEH
method
#
addSEH adds SEH information to the COFF file f.
func (f *peFile) addSEH(ctxt *Link)
addSection
method
#
addSection adds section to the COFF file f.
func (f *peFile) addSection(name string, sectsize int, filesize int) *peSection
addSection
method
#
addSection adds section to the XCOFF file f.
func (f *xcoffFile) addSection(name string, addr uint64, size uint64, fileoff uint64, flags uint32) *XcoffScnHdr64
addSection
method
#
addSection adds the section of r (passed to newFipsObj)
starting at byte offset start and ending before byte offset end
to the fips object file.
func (f *fipsObj) addSection(start int64, end int64) error
addSymbol
method
#
addSymbol writes a symbol or an auxiliary symbol entry on ctxt.out.
func (f *xcoffFile) addSymbol(sym xcoffSym)
addbuildinfo
function
#
func addbuildinfo(ctxt *Link)
adddwarfref
method
#
func (d *dwctxt) adddwarfref(sb *loader.SymbolBuilder, t loader.Sym, size int)
adddynimpsym
method
#
(*xcoffFile)adddynimpsym adds the dynamic symbol "s" to a XCOFF file.
A new symbol named s.Extname() is created to be the actual dynamic symbol
in the .loader section and in the symbol table as an External Reference.
The symbol "s" is transformed to SXCOFFTOC to end up in .data section.
However, there is no writing protection on those symbols and
it might need to be added.
TODO(aix): Handles dynamic symbols without library.
func (f *xcoffFile) adddynimpsym(ctxt *Link, s loader.Sym)
adddynlib
function
#
func adddynlib(ctxt *Link, lib string)
addelflib
function
#
func addelflib(list **Elflib, file string, vers string) *Elfaux
addentry
method
#
func (rt *peBaseRelocTable) addentry(ldr *loader.Loader, s loader.Sym, r *loader.Reloc)
addexport
method
#
func (ctxt *Link) addexport()
addexports
function
#
func addexports(ctxt *Link)
addgonote
function
#
func addgonote(ctxt *Link, sectionName string, tag uint32, desc []byte)
addgostring
function
#
addgostring adds str, as a Go string value, to s. symname is the name of the
symbol used to define the string data and must be unique per linked object.
func addgostring(ctxt *Link, ldr *loader.Loader, s *loader.SymbolBuilder, symname string, str string)
addimports
function
#
func addimports(ctxt *Link, datsect *peSection)
addinitarrdata
function
#
func addinitarrdata(ctxt *Link, ldr *loader.Loader, s loader.Sym)
addlib
function
#
func addlib(ctxt *Link, src string, obj string, lib string, fingerprint goobj.FingerprintType) *sym.Library
addlibpath
function
#
* add library to library list, return added library.
* srcref: src file referring to package
* objref: object file referring to package
* file: object file, e.g., /home/rsc/go/pkg/container/vector.a
* pkg: package import path, e.g. container/vector
* shlib: path to shared library, or .shlibname file holding path
* fingerprint: if not 0, expected fingerprint for import from srcref
* fingerprint is 0 if the library is not imported (e.g. main)
func addlibpath(ctxt *Link, srcref string, objref string, file string, pkg string, shlib string, fingerprint goobj.FingerprintType) *sym.Library
addpersrc
function
#
func addpersrc(ctxt *Link)
address
method
#
address assigns virtual addresses to all segments and sections and
returns all segments in file order.
func (ctxt *Link) address() []*sym.Segment
addsection
function
#
func addsection(ldr *loader.Loader, arch *sys.Arch, seg *sym.Segment, name string, rwx int) *sym.Section
addstrdata
function
#
addstrdata sets the initial value of the string variable name to value.
func addstrdata(arch *sys.Arch, l *loader.Loader, name string, value string)
addstrdata1
function
#
func addstrdata1(ctxt *Link, arg string)
afterErrorAction
function
#
afterErrorAction updates 'nerrors' on error and invokes exit or
panics in the proper circumstances.
func afterErrorAction()
aligndatsize
function
#
func aligndatsize(state *dodataState, datsize int64, s loader.Sym) int64
allocateDataSectionForSym
method
#
allocateDataSectionForSym creates a new sym.Section into which a
single symbol will be placed. Here "seg" is the segment into which
the section will go, "s" is the symbol to be placed into the new
section, and "rwx" contains permissions for the section.
func (state *dodataState) allocateDataSectionForSym(seg *sym.Segment, s loader.Sym, rwx int) *sym.Section
allocateDataSections
method
#
allocateDataSections allocates sym.Section objects for data/rodata
(and related) symbols, and then assigns symbols to those sections.
func (state *dodataState) allocateDataSections(ctxt *Link)
allocateDwarfSections
method
#
allocateDwarfSections allocates sym.Section objects for DWARF
symbols, and assigns symbols to sections.
func (state *dodataState) allocateDwarfSections(ctxt *Link)
allocateNamedDataSection
method
#
allocateNamedDataSection creates a new sym.Section for a category
of data symbols. Here "seg" is the segment into which the section
will go, "sName" is the name to give to the section, "types" is a
range of symbol types to be put into the section, and "rwx"
contains permissions for the section.
func (state *dodataState) allocateNamedDataSection(seg *sym.Segment, sName string, types []sym.SymKind, rwx int) *sym.Section
allocateNamedSectionAndAssignSyms
method
#
allocateNamedSectionAndAssignSyms creates a new section with the
specified name, then walks through the bucketed data symbols with
type 'symn' and assigns each of them to this new section. "Seg" is
the segment into which to place the new section, "secName" is the
name to give to the new section, "forceType" (if non-zero) contains
a new sym type to apply to each sym during the assignment, and
"rwx" holds section permissions.
func (state *dodataState) allocateNamedSectionAndAssignSyms(seg *sym.Segment, secName string, symn sym.SymKind, forceType sym.SymKind, rwx int) *sym.Section
allocateSEHSections
method
#
allocateSEHSections allocate a sym.Section object for SEH
symbols, and assigns symbols to sections.
func (state *dodataState) allocateSEHSections(ctxt *Link)
allocateSingleSymSections
method
#
allocateSingleSymSections walks through the bucketed data symbols
with type 'symn', creates a new section for each sym, and assigns
the sym to a newly created section. Section name is set from the
symbol name. "Seg" is the segment into which to place the new
section, "forceType" is the new sym.SymKind to assign to the symbol
within the section, and "rwx" holds section permissions.
func (state *dodataState) allocateSingleSymSections(seg *sym.Segment, symn sym.SymKind, forceType sym.SymKind, rwx int)
appendPCDeltaCFA
function
#
appendPCDeltaCFA appends per-PC CFA deltas to b and returns the final slice.
func appendPCDeltaCFA(arch *sys.Arch, b []byte, deltapc int64, cfa int64) []byte
appendString
function
#
appendString appends s to data, prefixed by its varint-encoded length.
func appendString(data []byte, s string) []byte
archive
method
#
archive builds a .a archive from the hostobj object files.
func (ctxt *Link) archive()
artrim
function
#
func artrim(x []byte) string
asmElfSym
function
#
func asmElfSym(ctxt *Link)
asmaixsym
method
#
Generate XCOFF Symbol table.
It will be written in out file in Asmbxcoff, because it must be
at the very end, especially after relocation sections which needs symbols' index.
func (f *xcoffFile) asmaixsym(ctxt *Link)
asmb
function
#
Assembling the binary is broken into two steps:
- writing out the code/data/dwarf Segments, applying relocations on the fly
- writing out the architecture specific pieces.
This function handles the first part.
func asmb(ctxt *Link)
asmb2
function
#
Assembling the binary is broken into two steps:
- writing out the code/data/dwarf Segments
- writing out the architecture specific pieces.
This function handles the second part.
func asmb2(ctxt *Link)
asmbElf
function
#
func asmbElf(ctxt *Link)
asmbMacho
function
#
func asmbMacho(ctxt *Link)
asmbPe
function
#
func asmbPe(ctxt *Link)
asmbPlan9
function
#
asmbPlan9 assembles a plan 9 binary.
func asmbPlan9(ctxt *Link)
asmbPlan9Sym
function
#
func asmbPlan9Sym(ctxt *Link)
asmbXcoff
function
#
Generate XCOFF assembly file.
func asmbXcoff(ctxt *Link)
asmbfips
function
#
asmbfips is called from [asmb] to update go:fipsinfo
when using internal linking.
See [hostlinkfips] for external linking.
func asmbfips(ctxt *Link, fipso string)
assignAddress
function
#
assigns address for a text symbol, returns (possibly new) section, its number, and the address.
func assignAddress(ctxt *Link, sect *sym.Section, n int, s loader.Sym, va uint64, isTramp bool, big bool) (*sym.Section, int, uint64)
assignDsymsToSection
method
#
assignDsymsToSection assigns a collection of data symbols to a
newly created section. "sect" is the section into which to place
the symbols, "syms" holds the list of symbols to assign,
"forceType" (if non-zero) contains a new sym type to apply to each
sym during the assignment, and "aligner" is a hook to call to
handle alignment during the assignment process.
func (state *dodataState) assignDsymsToSection(sect *sym.Section, syms []loader.Sym, forceType sym.SymKind, aligner func(state *dodataState, datsize int64, s loader.Sym) int64)
assignToSection
method
#
func (state *dodataState) assignToSection(sect *sym.Section, symn sym.SymKind, forceType sym.SymKind)
atolwhex
function
#
func atolwhex(s string) int64
bgetc
function
#
func bgetc(r *bio.Reader) int
buildinfo
method
#
func (ctxt *Link) buildinfo()
calcCompUnitRanges
method
#
calcCompUnitRanges calculates the PC ranges of the compilation units.
func (d *dwctxt) calcCompUnitRanges()
calculateFunctabSize
method
#
calculateFunctabSize calculates the size of the pclntab, and the offsets in
the output buffer for individual func entries.
func (state pclntab) calculateFunctabSize(ctxt *Link, funcs []loader.Sym) (int64, []uint32)
callgraph
method
#
func (ctxt *Link) callgraph()
captureHostObj
function
#
captureHostObj writes out the content of a host object (pulled from
an archive or loaded from a *.o file directly) to a directory
specified via the linker's "-capturehostobjs" debugging flag. This
is intended to make it easier for a developer to inspect the actual
object feeding into "CGO internal" link step.
func captureHostObj(h *Hostobj)
check
method
#
check returns the stack height of sym. It populates sc.height and
sc.graph for sym and every function in its call tree.
func (sc *stackCheck) check(sym loader.Sym) int
checkFingerprint
function
#
func checkFingerprint(lib *sym.Library, libfp goobj.FingerprintType, src string, srcfp goobj.FingerprintType)
checkOffset
method
#
checkOffset verifies COFF section sect offset in the file.
func (sect *peSection) checkOffset(off int64)
checkSectSize
function
#
func checkSectSize(sect *sym.Section)
checkSegment
method
#
checkSegment verifies COFF section sect matches address
and file offset provided in segment seg.
func (sect *peSection) checkSegment(seg *sym.Segment)
checkdatsize
method
#
check accumulated size of data sections
func (state *dodataState) checkdatsize(symn sym.SymKind)
cleanTimeStamps
function
#
cleanTimeStamps resets the timestamps for the specified list of
existing files to the Unix epoch (1970-01-01 00:00:00 +0000 UTC).
We take this step in order to help preserve reproducible builds;
this seems to be primarily needed for external linking on Darwin
with later versions of xcode, which (unfortunately) seem to want to
incorporate object file times into the final output file's build
ID. See issue 64947 for the unpleasant details.
func cleanTimeStamps(files []string)
collectUnitLocs
method
#
func (d *dwctxt) collectUnitLocs(u *sym.CompilationUnit) []loader.Sym
collectmachosyms
function
#
func collectmachosyms(ctxt *Link)
commonsize
function
#
func commonsize(arch *sys.Arch) int
compilationUnitByStartPCCmp
function
#
func compilationUnitByStartPCCmp(a *sym.CompilationUnit, b *sym.CompilationUnit) int
compressSyms
function
#
compressSyms compresses syms and returns the contents of the
compressed section. If the section would get larger, it returns nil.
func compressSyms(ctxt *Link, syms []loader.Sym) []byte
computeDeferReturn
function
#
func computeDeferReturn(ctxt *Link, deferReturnSym loader.Sym, s loader.Sym) uint32
computeHeight
method
#
computeHeight returns the stack height of sym. If graph is true, it
also returns the out-edges of sym.
Caching is applied to this in check. Call check instead of calling
this directly.
func (sc *stackCheck) computeHeight(sym loader.Sym, graph bool) (int, []stackCheckEdge)
computeTLSOffset
method
#
computeTLSOffset records the thread-local storage offset.
Not used for Android where the TLS offset is determined at runtime.
func (ctxt *Link) computeTLSOffset()
copyHeap
method
#
copyHeap copies the heap to the mmapped section of memory, returning true if
a copy takes place.
func (out *OutBuf) copyHeap() bool
copychildren
method
#
func (d *dwctxt) copychildren(ctxt *Link, dst *dwarf.DWDie, src *dwarf.DWDie)
copychildrenexcept
method
#
Copies src's children into dst. Copies attributes by value.
DWAttr.data is copied as pointer only. If except is one of
the top-level children, it will not be copied.
func (d *dwctxt) copychildrenexcept(ctxt *Link, dst *dwarf.DWDie, src *dwarf.DWDie, except *dwarf.DWDie)
createGeneratorSymbol
method
#
createGeneratorSymbol is a convenience method for creating a generator
symbol.
func (ctxt *Link) createGeneratorSymbol(name string, version int, t sym.SymKind, size int64, gen generatorFunc) loader.Sym
createUnitLength
method
#
createUnitLength creates the initial length field with value v and update
offset of unit_length if needed.
func (d *dwctxt) createUnitLength(su *loader.SymbolBuilder, v uint64)
datblk
function
#
func datblk(ctxt *Link, out *OutBuf, addr int64, size int64)
datoff
function
#
func datoff(ldr *loader.Loader, s loader.Sym, addr int64) int64
deadcode
function
#
deadcode marks all reachable symbols.
The basis of the dead code elimination is a flood fill of symbols,
following their relocations, beginning at *flagEntrySymbol.
This flood fill is wrapped in logic for pruning unused methods.
All methods are mentioned by relocations on their receiver's *rtype.
These relocations are specially defined as R_METHODOFF by the compiler
so we can detect and manipulated them here.
There are three ways a method of a reachable type can be invoked:
1. direct call
2. through a reachable interface type
3. reflect.Value.Method (or MethodByName), or reflect.Type.Method
(or MethodByName)
The first case is handled by the flood fill, a directly called method
is marked as reachable.
The second case is handled by decomposing all reachable interface
types into method signatures. Each encountered method is compared
against the interface method signatures, if it matches it is marked
as reachable. This is extremely conservative, but easy and correct.
The third case is handled by looking for functions that compiler flagged
as REFLECTMETHOD. REFLECTMETHOD on a function F means that F does a method
lookup with reflection, but the compiler was not able to statically determine
the method name.
All functions that call reflect.Value.Method or reflect.Type.Method are REFLECTMETHODs.
Functions that call reflect.Value.MethodByName or reflect.Type.MethodByName with
a non-constant argument are REFLECTMETHODs, too. If we find a REFLECTMETHOD,
we give up on static analysis, and mark all exported methods of all reachable
types as reachable.
If the argument to MethodByName is a compile-time constant, the compiler
emits a relocation with the method name. Matching methods are kept in all
reachable types.
Any unreached text symbols are removed from ctxt.Textp.
func deadcode(ctxt *Link)
decodeGenericIfaceMethod
method
#
Decode the method name stored in symbol symIdx. The symbol should contain just the bytes of a method name.
func (d *deadcodePass) decodeGenericIfaceMethod(ldr *loader.Loader, symIdx loader.Sym) string
decodeIfaceMethod
method
#
Decode the method of interface type symbol symIdx at offset off.
func (d *deadcodePass) decodeIfaceMethod(ldr *loader.Loader, arch *sys.Arch, symIdx loader.Sym, off int64) methodsig
decodeInuxi
function
#
func decodeInuxi(arch *sys.Arch, p []byte, sz int) uint64
decodeItabType
function
#
decodeItabType returns the itab.Type field from an itab.
func decodeItabType(ldr *loader.Loader, arch *sys.Arch, symIdx loader.Sym) loader.Sym
decodeMethodSig
method
#
decodeMethodSig decodes an array of method signature information.
Each element of the array is size bytes. The first 4 bytes is a
nameOff for the method name, and the next 4 bytes is a typeOff for
the function type.
Conveniently this is the layout of both runtime.method and runtime.imethod.
func (d *deadcodePass) decodeMethodSig(ldr *loader.Loader, arch *sys.Arch, symIdx loader.Sym, relocs *loader.Relocs, off int, size int, count int) []methodsig
decodeReloc
function
#
func decodeReloc(ldr *loader.Loader, symIdx loader.Sym, relocs *loader.Relocs, off int32) loader.Reloc
decodeRelocSym
function
#
func decodeRelocSym(ldr *loader.Loader, symIdx loader.Sym, relocs *loader.Relocs, off int32) loader.Sym
decodeTargetSym
function
#
decodeTargetSym finds the symbol pointed to by the pointer slot at offset off in s.
func decodeTargetSym(ctxt *Link, arch *sys.Arch, s loader.Sym, off int64) loader.Sym
decodetypeArrayElem
function
#
func decodetypeArrayElem(ctxt *Link, arch *sys.Arch, symIdx loader.Sym) loader.Sym
decodetypeArrayLen
function
#
func decodetypeArrayLen(ldr *loader.Loader, arch *sys.Arch, symIdx loader.Sym) int64
decodetypeChanElem
function
#
func decodetypeChanElem(ldr *loader.Loader, arch *sys.Arch, symIdx loader.Sym) loader.Sym
decodetypeFuncDotdotdot
function
#
Type.FuncType.dotdotdot
func decodetypeFuncDotdotdot(arch *sys.Arch, p []byte) bool
decodetypeFuncInCount
function
#
Type.FuncType.inCount
func decodetypeFuncInCount(arch *sys.Arch, p []byte) int
decodetypeFuncInType
function
#
func decodetypeFuncInType(ldr *loader.Loader, arch *sys.Arch, symIdx loader.Sym, relocs *loader.Relocs, i int) loader.Sym
decodetypeFuncOutCount
function
#
func decodetypeFuncOutCount(arch *sys.Arch, p []byte) int
decodetypeFuncOutType
function
#
func decodetypeFuncOutType(ldr *loader.Loader, arch *sys.Arch, symIdx loader.Sym, relocs *loader.Relocs, i int) loader.Sym
decodetypeGCMaskOnDemand
function
#
Type.commonType.tflag
func decodetypeGCMaskOnDemand(arch *sys.Arch, p []byte) bool
decodetypeGcmask
function
#
func decodetypeGcmask(ctxt *Link, s loader.Sym) []byte
decodetypeGcprog
function
#
Type.commonType.gc
func decodetypeGcprog(ctxt *Link, s loader.Sym) []byte
decodetypeGcprogShlib
function
#
func decodetypeGcprogShlib(ctxt *Link, data []byte) uint64
decodetypeHasUncommon
function
#
Type.commonType.tflag
func decodetypeHasUncommon(arch *sys.Arch, p []byte) bool
decodetypeIfaceMethodCount
function
#
InterfaceType.methods.length
func decodetypeIfaceMethodCount(arch *sys.Arch, p []byte) int64
decodetypeKind
function
#
Type.commonType.kind
func decodetypeKind(arch *sys.Arch, p []byte) abi.Kind
decodetypeMapKey
function
#
func decodetypeMapKey(ldr *loader.Loader, arch *sys.Arch, symIdx loader.Sym) loader.Sym
decodetypeMapSwissGroup
function
#
func decodetypeMapSwissGroup(ldr *loader.Loader, arch *sys.Arch, symIdx loader.Sym) loader.Sym
decodetypeMapValue
function
#
func decodetypeMapValue(ldr *loader.Loader, arch *sys.Arch, symIdx loader.Sym) loader.Sym
decodetypeMethods
method
#
func (d *deadcodePass) decodetypeMethods(ldr *loader.Loader, arch *sys.Arch, symIdx loader.Sym, relocs *loader.Relocs) []methodsig
decodetypeName
function
#
decodetypeName decodes the name from a reflect.name.
func decodetypeName(ldr *loader.Loader, symIdx loader.Sym, relocs *loader.Relocs, off int) string
decodetypeNameEmbedded
function
#
func decodetypeNameEmbedded(ldr *loader.Loader, symIdx loader.Sym, relocs *loader.Relocs, off int) bool
decodetypePtrElem
function
#
func decodetypePtrElem(ldr *loader.Loader, arch *sys.Arch, symIdx loader.Sym) loader.Sym
decodetypePtrdata
function
#
Type.commonType.ptrdata
func decodetypePtrdata(arch *sys.Arch, p []byte) int64
decodetypeSize
function
#
Type.commonType.size
func decodetypeSize(arch *sys.Arch, p []byte) int64
decodetypeStr
function
#
decodetypeStr returns the contents of an rtype's str field (a nameOff).
func decodetypeStr(ldr *loader.Loader, arch *sys.Arch, symIdx loader.Sym) string
decodetypeStructFieldArrayOff
function
#
func decodetypeStructFieldArrayOff(ldr *loader.Loader, arch *sys.Arch, symIdx loader.Sym, i int) int
decodetypeStructFieldCount
function
#
func decodetypeStructFieldCount(ldr *loader.Loader, arch *sys.Arch, symIdx loader.Sym) int
decodetypeStructFieldEmbedded
function
#
func decodetypeStructFieldEmbedded(ldr *loader.Loader, arch *sys.Arch, symIdx loader.Sym, i int) bool
decodetypeStructFieldName
function
#
func decodetypeStructFieldName(ldr *loader.Loader, arch *sys.Arch, symIdx loader.Sym, i int) string
decodetypeStructFieldOffset
function
#
func decodetypeStructFieldOffset(ldr *loader.Loader, arch *sys.Arch, symIdx loader.Sym, i int) int64
decodetypeStructFieldType
function
#
func decodetypeStructFieldType(ctxt *Link, arch *sys.Arch, symIdx loader.Sym, i int) loader.Sym
dedupLibraries
function
#
func dedupLibraries(ctxt *Link, libs []string) []string
dedupLibrariesOpenBSD
function
#
dedupLibrariesOpenBSD dedups a list of shared libraries, treating versioned
and unversioned libraries as equivalents. Versioned libraries are preferred
and retained over unversioned libraries. This avoids the situation where
the use of cgo results in a DT_NEEDED for a versioned library (for example,
libc.so.96.1), while a dynamic import specifies an unversioned library (for
example, libc.so) - this would otherwise result in two DT_NEEDED entries
for the same library, resulting in a failure when ld.so attempts to load
the Go binary.
func dedupLibrariesOpenBSD(ctxt *Link, libs []string) []string
defgotype
method
#
Define gotype, for composite ones recurse into constituents.
func (d *dwctxt) defgotype(gotype loader.Sym) loader.Sym
defineInternal
method
#
defineInternal defines a symbol used internally by the go runtime.
func (ctxt *Link) defineInternal(p string, t sym.SymKind) loader.Sym
defptrto
method
#
func (d *dwctxt) defptrto(dwtype loader.Sym) loader.Sym
determineLinkMode
function
#
determineLinkMode sets ctxt.LinkMode.
It is called after flags are processed and inputs are processed,
so the ctxt.LinkMode variable has an initial value from the -linkmode
flag and the iscgo, externalobj, and unknownObjFormat variables are set.
func determineLinkMode(ctxt *Link)
dfs
function
#
func dfs(lib *sym.Library, mark map[*sym.Library]markKind, order *[]*sym.Library)
doMachoLink
function
#
func doMachoLink(ctxt *Link) int64
doStackCheck
method
#
doStackCheck walks the call tree to check that there is always
enough stack space for call frames, especially for a chain of
nosplit functions.
It walks all functions to accumulate the number of bytes they can
grow the stack by without a split check and checks this against the
limit.
func (ctxt *Link) doStackCheck()
dodata
method
#
func (ctxt *Link) dodata(symGroupType []sym.SymKind)
dodataSect
method
#
func (state *dodataState) dodataSect(ctxt *Link, symn sym.SymKind, syms []loader.Sym) (result []loader.Sym, maxAlign int32)
doelf
method
#
func (ctxt *Link) doelf()
domacho
method
#
func (ctxt *Link) domacho()
dope
method
#
func (ctxt *Link) dope()
dostrdata
method
#
func (ctxt *Link) dostrdata()
dotypedef
method
#
func (d *dwctxt) dotypedef(parent *dwarf.DWDie, name string, def *dwarf.DWDie) *dwarf.DWDie
doxcoff
method
#
func (ctxt *Link) doxcoff()
dtolsym
method
#
func (d *dwctxt) dtolsym(s dwarf.Sym) loader.Sym
dumpDepAddFlags
method
#
func (d *deadcodePass) dumpDepAddFlags(name string, symIdx loader.Sym) string
dwUnitPortion
method
#
dwUnitPortion assembles the DWARF content for a given compilation
unit: debug_info, debug_lines, debug_ranges, debug_loc (debug_frame
is handled elsewhere). Order is important; the calls to writelines
and writepcranges below make updates to the compilation unit DIE,
hence they have to happen before the call to writeUnitInfo.
func (d *dwctxt) dwUnitPortion(u *sym.CompilationUnit, abbrevsym loader.Sym, us *dwUnitSyms)
dwarfEnabled
function
#
func dwarfEnabled(ctxt *Link) bool
dwarfGenerateDebugInfo
function
#
dwarfGenerateDebugInfo generated debug info entries for all types,
variables and functions in the program.
Along with dwarfGenerateDebugSyms they are the two main entry points into
dwarf generation: dwarfGenerateDebugInfo does all the work that should be
done before symbol names are mangled while dwarfGenerateDebugSyms does
all the work that can only be done after addresses have been assigned to
text symbols.
func dwarfGenerateDebugInfo(ctxt *Link)
dwarfGenerateDebugSyms
method
#
func (d *dwctxt) dwarfGenerateDebugSyms()
dwarfGenerateDebugSyms
function
#
dwarfGenerateDebugSyms constructs debug_line, debug_frame, and
debug_loc. It also writes out the debug_info section using symbols
generated in dwarfGenerateDebugInfo2.
func dwarfGenerateDebugSyms(ctxt *Link)
dwarfVisitFunction
method
#
dwarfVisitFunction takes a function (text) symbol and processes the
subprogram DIE for the function and picks up any other DIEs
(absfns, types) that it references.
func (d *dwctxt) dwarfVisitFunction(fnSym loader.Sym, unit *sym.CompilationUnit)
dwarfaddelfsectionsyms
function
#
func dwarfaddelfsectionsyms(ctxt *Link)
dwarfaddshstrings
function
#
Add DWARF section names to the section header string table, by calling add
on each name. ELF only.
func dwarfaddshstrings(ctxt *Link, add func(string))
dwarfblk
function
#
func dwarfblk(ctxt *Link, out *OutBuf, addr int64, size int64)
dwarfcompress
function
#
dwarfcompress compresses the DWARF sections. Relocations are applied
on the fly. After this, dwarfp will contain a different (new) set of
symbols, and sections may have been replaced.
func dwarfcompress(ctxt *Link)
dynreloc
method
#
func (state *dodataState) dynreloc(ctxt *Link)
dynrelocsym
function
#
func dynrelocsym(ctxt *Link, s loader.Sym)
elf32phdr
function
#
func elf32phdr(out *OutBuf, e *ElfPhdr)
elf32shdr
function
#
func elf32shdr(out *OutBuf, e *ElfShdr)
elf32writehdr
function
#
func elf32writehdr(out *OutBuf) uint32
elf64phdr
function
#
func elf64phdr(out *OutBuf, e *ElfPhdr)
elf64shdr
function
#
func elf64shdr(out *OutBuf, e *ElfShdr)
elf64writehdr
function
#
func elf64writehdr(out *OutBuf) uint32
elfEmitReloc
function
#
func elfEmitReloc(ctxt *Link)
elfMipsAbiFlags
function
#
func elfMipsAbiFlags(sh *ElfShdr, startva uint64, resoff uint64) int
elfWriteDynEntSym
function
#
func elfWriteDynEntSym(ctxt *Link, s *loader.SymbolBuilder, tag elf.DynTag, t loader.Sym)
elfWriteMipsAbiFlags
function
#
Layout is given by this C definition:
typedef struct
{
/* Version of flags structure.
uint16_t version;
/* The level of the ISA: 1-5, 32, 64.
uint8_t isa_level;
/* The revision of ISA: 0 for MIPS V and below, 1-n otherwise.
uint8_t isa_rev;
/* The size of general purpose registers.
uint8_t gpr_size;
/* The size of co-processor 1 registers.
uint8_t cpr1_size;
/* The size of co-processor 2 registers.
uint8_t cpr2_size;
/* The floating-point ABI.
uint8_t fp_abi;
/* Processor-specific extension.
uint32_t isa_ext;
/* Mask of ASEs used.
uint32_t ases;
/* Mask of general flags.
uint32_t flags1;
uint32_t flags2;
} Elf_Internal_ABIFlags_v0;
func elfWriteMipsAbiFlags(ctxt *Link) int
elfadddynsym
function
#
func elfadddynsym(ldr *loader.Loader, target *Target, syms *ArchSyms, s loader.Sym)
elfbuildinfo
function
#
func elfbuildinfo(sh *ElfShdr, startva uint64, resoff uint64) int
elfdynhash
function
#
func elfdynhash(ctxt *Link)
elffips
function
#
machofips updates go:fipsinfo after external linking
on systems using ELF (most Unix systems).
func elffips(ctxt *Link, exe string, fipso string) error
elffreebsdsig
function
#
func elffreebsdsig(sh *ElfShdr, startva uint64, resoff uint64) int
elfgobuildid
function
#
func elfgobuildid(sh *ElfShdr, startva uint64, resoff uint64) int
elfhash
function
#
Taken directly from the definition document for ELF64.
func elfhash(name string) uint32
elfinterp
function
#
func elfinterp(sh *ElfShdr, startva uint64, resoff uint64, p string) int
elfnetbsdpax
function
#
func elfnetbsdpax(sh *ElfShdr, startva uint64, resoff uint64) int
elfnetbsdsig
function
#
func elfnetbsdsig(sh *ElfShdr, startva uint64, resoff uint64) int
elfnote
function
#
func elfnote(sh *ElfShdr, startva uint64, resoff uint64, sizes ...int) int
elfopenbsdsig
function
#
func elfopenbsdsig(sh *ElfShdr, startva uint64, resoff uint64) int
elfphload
function
#
func elfphload(seg *sym.Segment) *ElfPhdr
elfphrelro
function
#
func elfphrelro(seg *sym.Segment)
elfrelocsect
function
#
func elfrelocsect(ctxt *Link, out *OutBuf, sect *sym.Section, syms []loader.Sym)
elfsetstring
function
#
func elfsetstring(ctxt *Link, s loader.Sym, str string, off int)
elfshalloc
function
#
func elfshalloc(sect *sym.Section) *ElfShdr
elfshbits
function
#
func elfshbits(linkmode LinkMode, sect *sym.Section) *ElfShdr
elfshname
function
#
func elfshname(name string) *ElfShdr
elfshnamedup
function
#
Create an ElfShdr for the section with name.
Create a duplicate if one already exists with that name.
func elfshnamedup(name string) *ElfShdr
elfshreloc
function
#
func elfshreloc(arch *sys.Arch, sect *sym.Section) *ElfShdr
elfwritebuildinfo
function
#
func elfwritebuildinfo(out *OutBuf) int
elfwritedynentsymsize
function
#
func elfwritedynentsymsize(ctxt *Link, s *loader.SymbolBuilder, tag elf.DynTag, t loader.Sym)
elfwritefreebsdsig
function
#
elfwritefreebsdsig writes FreeBSD .note section.
See https://www.netbsd.org/docs/kernel/elf-notes.html for the description of
a Note element format and
https://github.com/freebsd/freebsd-src/blob/main/sys/sys/elf_common.h#L790
for the FreeBSD-specific values.
func elfwritefreebsdsig(out *OutBuf) int
elfwritegobuildid
function
#
func elfwritegobuildid(out *OutBuf) int
elfwritehdr
function
#
func elfwritehdr(out *OutBuf) uint32
elfwriteinterp
function
#
func elfwriteinterp(out *OutBuf) int
elfwritenetbsdpax
function
#
func elfwritenetbsdpax(out *OutBuf) int
elfwritenetbsdsig
function
#
func elfwritenetbsdsig(out *OutBuf) int
elfwritenotehdr
function
#
func elfwritenotehdr(out *OutBuf, str string, namesz uint32, descsz uint32, tag uint32) *ElfShdr
elfwriteopenbsdsig
function
#
func elfwriteopenbsdsig(out *OutBuf) int
elfwritephdrs
function
#
func elfwritephdrs(out *OutBuf) uint32
elfwriteshdrs
function
#
func elfwriteshdrs(out *OutBuf) uint32
emitPcln
function
#
func emitPcln(ctxt *Link, s loader.Sym, container loader.Bitmap) bool
emitRelocations
method
#
emitRelocations emits the relocation entries for the sect.
The actual relocations are emitted by relocfn.
This updates the corresponding PE section table entry
with the relocation offset and count.
func (sect *peSection) emitRelocations(out *OutBuf, relocfn func() int)
emitRelocations
method
#
emitRelocations emits relocation entries for go.o in external linking.
func (f *peFile) emitRelocations(ctxt *Link)
emitRelocations
method
#
emitRelocations emits relocation entries for go.o in external linking.
func (f *xcoffFile) emitRelocations(ctxt *Link, fileoff int64)
empty
method
#
func (h *lexHeap) empty() bool
empty
method
#
func (h *heap) empty() bool
errorUnresolved
method
#
errorUnresolved prints unresolved symbol error for rs that is referenced from s.
func (reporter *ErrorReporter) errorUnresolved(ldr *loader.Loader, s loader.Sym, rs loader.Sym)
errorexit
function
#
func errorexit()
execArchive
method
#
execArchive invokes the archiver tool with syscall.Exec(), with
the expectation that this is the last thing that takes place
in the linking operation.
func (ctxt *Link) execArchive(argv []string)
execArchive
method
#
func (ctxt *Link) execArchive(argv []string)
exitIfErrors
function
#
func exitIfErrors()
expandFile
function
#
func expandFile(fname string) string
expandGoroot
function
#
func expandGoroot(s string) string
extld
method
#
extld returns the current external linker.
func (ctxt *Link) extld() []string
extreloc
function
#
Convert a Go relocation to an external relocation.
func extreloc(ctxt *Link, ldr *loader.Loader, s loader.Sym, r loader.Reloc) (loader.ExtReloc, bool)
fallocate
method
#
func (out *OutBuf) fallocate(size uint64) error
fallocate
method
#
func (out *OutBuf) fallocate(size uint64) error
fallocate
method
#
func (out *OutBuf) fallocate(size uint64) error
fallocate
method
#
func (out *OutBuf) fallocate(size uint64) error
fcntl
function
#
Implemented in the syscall package.
go:linkname fcntl syscall.fcntl
func fcntl(fd int, cmd int, arg int) (int, error)
fieldtrack
function
#
func fieldtrack(arch *sys.Arch, l *loader.Loader)
find
method
#
find looks up the loader symbol for the DWARF DIE generated for the
type with the specified name.
func (d *dwctxt) find(name string) loader.Sym
findContainerSyms
method
#
findContainerSyms returns a bitmap, indexed by symbol number, where there's
a 1 for every container symbol.
func (ctxt *Link) findContainerSyms() loader.Bitmap
findExtLinkTool
method
#
findExtLinkTool invokes the external linker CC with --print-prog-name
passing the name of the tool we're interested in, such as "strip",
"ar", or "dsymutil", and returns the path passed back from the command.
func (ctxt *Link) findExtLinkTool(toolname string) string
findLibPath
method
#
findLibPath searches for library libname.
It returns library full path if found, or "none" if not found.
func (ctxt *Link) findLibPath(libname string) string
findLibPathCmd
method
#
findLibPathCmd uses cmd command to find gcc library libname.
It returns library full path if found, or "none" if not found.
func (ctxt *Link) findLibPathCmd(cmd string, libname string) string
findRoots
method
#
func (sc *stackCheck) findRoots() []loader.Sym
findShlibSection
function
#
Find the elf.Section of a given shared library that contains a given address.
func findShlibSection(ctxt *Link, path string, addr uint64) *elf.Section
findchild
function
#
Find child by AT_name using hashtable if available or linear scan
if not.
func findchild(die *dwarf.DWDie, name string) *dwarf.DWDie
findfunctab
method
#
findfunctab generates a lookup table to quickly find the containing
function for a pc. See src/runtime/symtab.go:findfunc for details.
func (ctxt *Link) findfunctab(state *pclntab, container loader.Bitmap)
findlib
function
#
func findlib(ctxt *Link, lib string) (string, bool)
findprotodie
method
#
func (d *dwctxt) findprotodie(ctxt *Link, name string) *dwarf.DWDie
findshlib
function
#
func findshlib(ctxt *Link, shlib string) string
fixElfPhdr
function
#
Make sure PT_LOAD is aligned properly and
that there is no gap,
correct ELF loaders will do this implicitly,
but buggy ELF loaders like the one in some
versions of QEMU and UPX won't.
func fixElfPhdr(e *ElfPhdr)
fixZeroSizedSymbols
function
#
fixZeroSizedSymbols gives a few special symbols with zero size some space.
func fixZeroSizedSymbols(ctxt *Link)
flood
method
#
func (d *deadcodePass) flood()
funcData
function
#
funcData returns the funcdata and offsets for the FuncInfo.
The funcdata are written into runtime.functab after each func
object. This is a helper function to make querying the FuncInfo object
cleaner.
NB: Preload must be called on the FuncInfo before calling.
NB: fdSyms is used as scratch space.
func funcData(ldr *loader.Loader, s loader.Sym, fi loader.FuncInfo, inlSym loader.Sym, fdSyms []loader.Sym) []loader.Sym
genDynSym
method
#
func (f *xcoffFile) genDynSym(ctxt *Link)
genInlTreeSym
function
#
genInlTreeSym generates the InlTree sym for a function with the
specified FuncInfo.
func genInlTreeSym(ctxt *Link, cu *sym.CompilationUnit, fi loader.FuncInfo, arch *sys.Arch, nameOffsets map[loader.Sym]uint32) loader.Sym
genelfsym
function
#
func genelfsym(ctxt *Link, elfbind elf.SymBind)
generateFilenameTabs
method
#
generateFilenameTabs creates LUTs needed for filename lookup. Returns a slice
of the index at which each CU begins in runtime.cutab.
Function objects keep track of the files they reference to print the stack.
This function creates a per-CU list of filenames if CU[M] references
files[1-N], the following is generated:
runtime.cutab:
CU[M]
offsetToFilename[0]
offsetToFilename[1]
..
runtime.filetab
filename[0]
filename[1]
Looking up a filename then becomes:
0. Given a func, and filename index [K]
1. Get Func.CUIndex: M := func.cuOffset
2. Find filename offset: fileOffset := runtime.cutab[M+K]
3. Get the filename: getcstring(runtime.filetab[fileOffset])
func (state *pclntab) generateFilenameTabs(ctxt *Link, compUnits []*sym.CompilationUnit, funcs []loader.Sym) []uint32
generateFuncnametab
method
#
generateFuncnametab creates the function name table. Returns a map of
func symbol to the name offset in runtime.funcnamtab.
func (state *pclntab) generateFuncnametab(ctxt *Link, funcs []loader.Sym) map[loader.Sym]uint32
generateFunctab
method
#
generateFunctab creates the runtime.functab
runtime.functab contains two things:
- pc->func look up table.
- array of func objects, interleaved with pcdata and funcdata
func (state *pclntab) generateFunctab(ctxt *Link, funcs []loader.Sym, inlSyms map[loader.Sym]loader.Sym, cuOffsets []uint32, nameOffsets map[loader.Sym]uint32)
generatePctab
method
#
generatePctab creates the runtime.pctab variable, holding all the
deduplicated pcdata.
func (state *pclntab) generatePctab(ctxt *Link, funcs []loader.Sym)
getCompilationDir
function
#
func getCompilationDir() string
getDwsectCUSize
function
#
getDwsectCUSize retrieves the corresponding package size inside the current section.
func getDwsectCUSize(sname string, pkgname string) uint64
getElfEhdr
function
#
func getElfEhdr() *ElfEhdr
getMachoHdr
function
#
func getMachoHdr() *MachoHdr
getPkgFromCUSym
method
#
getPkgFromCUSym returns the package name for the compilation unit
represented by s.
The prefix dwarf.InfoPrefix+".pkg." needs to be removed in order to get
the package name.
func (d *dwctxt) getPkgFromCUSym(s loader.Sym) string
getXCOFFscnum
method
#
getXCOFFscnum returns the XCOFF section number of a Go section.
func (f *xcoffFile) getXCOFFscnum(sect *sym.Section) int16
getattr
function
#
Each DIE (except the root ones) has at least 1 attribute: its
name. getattr moves the desired one to the front so
frequently searched ones are found faster.
func getattr(die *dwarf.DWDie, attr uint16) *dwarf.DWAttr
hostArchive
function
#
hostArchive reads an archive file holding host objects and links in
required objects. The general format is the same as a Go archive
file, but it has an armap listing symbols and the objects that
define them. This is used for the compiler support library
libgcc.a.
func hostArchive(ctxt *Link, name string)
hostObject
function
#
hostObject reads a single host object file (compare to "hostArchive").
This is used as part of internal linking when we need to pull in
files such as "crt?.o".
func hostObject(ctxt *Link, objname string, path string)
hostlink
method
#
func (ctxt *Link) hostlink()
hostlinkArchArgs
function
#
hostlinkArchArgs returns arguments to pass to the external linker
based on the architecture.
func hostlinkArchArgs(arch *sys.Arch) []string
hostlinkfips
function
#
hostlinkfips is called from [hostlink] to update go:fipsinfo
when using external linking.
See [asmbfips] for internal linking.
func hostlinkfips(ctxt *Link, exe string, fipso string) error
hostlinksetup
function
#
func hostlinksetup(ctxt *Link)
hostobjCopy
method
#
hostobjCopy creates a copy of the object files in hostobj in a
temporary directory.
func (ctxt *Link) hostobjCopy() (paths []string)
hostobjMachoPlatform
function
#
hostobjMachoPlatform returns the first platform load command found
in the host object, if any.
func hostobjMachoPlatform(h *Hostobj) (*MachoPlatformLoad, error)
hostobjs
function
#
func hostobjs(ctxt *Link)
importInfoSymbol
method
#
func (d *dwctxt) importInfoSymbol(dsym loader.Sym)
init
method
#
func (rt *peBaseRelocTable) init(ctxt *Link)
init
function
#
func init()
init
method
#
func (d *deadcodePass) init()
initdynexport
function
#
func initdynexport(ctxt *Link)
initdynimport
function
#
func initdynimport(ctxt *Link) *Dll
inittaskSym
method
#
inittaskSym builds a symbol containing pointers to all the inittasks
that need to be run, given a list of root inittask symbols.
func (ctxt *Link) inittaskSym(rootNames []string, symName string) loader.Sym
inittasks
method
#
Inittasks finds inittask records, figures out a good
order to execute them in, and emits that order for the
runtime to use.
An inittask represents the initialization code that needs
to be run for a package. For package p, the p..inittask
symbol contains a list of init functions to run, both
explicit user init functions and implicit compiler-generated
init functions for initializing global variables like maps.
In addition, inittask records have dependencies between each
other, mirroring the import dependencies. So if package p
imports package q, then there will be a dependency p -> q.
We can't initialize package p until after package q has
already been initialized.
Package dependencies are encoded with relocations. If package
p imports package q, then package p's inittask record will
have a R_INITORDER relocation pointing to package q's inittask
record. See cmd/compile/internal/pkginit/init.go.
This function computes an ordering of all of the inittask
records so that the order respects all the dependencies,
and given that restriction, orders the inittasks in
lexicographic order.
func (ctxt *Link) inittasks()
isDwarf64
function
#
func isDwarf64(ctxt *Link) bool
isExported
method
#
func (m methodref) isExported() bool
isMmapped
method
#
isMmapped returns true if the OutBuf is mmaped.
func (out *OutBuf) isMmapped() bool
isPLTCall
function
#
whether rt is a (host object) relocation that will be turned into
a call to PLT.
func isPLTCall(arch *sys.Arch, rt objabi.RelocType) bool
isRuntimeDepPkg
function
#
isRuntimeDepPkg reports whether pkg is the runtime package or its dependency.
TODO: just compute from the runtime package, and remove this hardcoded list.
func isRuntimeDepPkg(pkg string) bool
isStaticTmp
function
#
func isStaticTmp(name string) bool
layout
method
#
layout assigns file offsets and lengths to the segments in order.
Returns the file size containing all the segments.
func (ctxt *Link) layout(order []*sym.Segment) uint64
ldhostobj
function
#
func ldhostobj(ld func(*Link, *bio.Reader, string, int64, string), headType objabi.HeadType, f *bio.Reader, pkg string, length int64, pn string, file string) *Hostobj
ldobj
function
#
ldobj loads an input object. If it is a host object (an object
compiled by a non-Go compiler) it returns the Hostobj pointer. If
it is a Go object, it returns nil.
func ldobj(ctxt *Link, f *bio.Reader, lib *sym.Library, length int64, pn string, file string) *Hostobj
ldpkg
function
#
func ldpkg(ctxt *Link, f *bio.Reader, lib *sym.Library, length int64, filename string)
ldshlibsyms
function
#
func ldshlibsyms(ctxt *Link, shlib string)
libinit
function
#
func libinit(ctxt *Link)
linkerFlagSupported
function
#
func linkerFlagSupported(arch *sys.Arch, linker string, altLinker string, flag string) bool
linknew
function
#
func linknew(arch *sys.Arch) *Link
linksetup
method
#
Set up flags and special symbols depending on the platform build mode.
This version works with loader.Loader.
func (ctxt *Link) linksetup()
loadWindowsHostArchives
function
#
loadWindowsHostArchives loads in host archives and objects when
doing internal linking on windows. Older toolchains seem to require
just a single pass through the various archives, but some modern
toolchains when linking a C program with mingw pass library paths
multiple times to the linker, e.g. "... -lmingwex -lmingw32 ...
-lmingwex -lmingw32 ...". To accommodate this behavior, we make two
passes over the host archives below.
func loadWindowsHostArchives(ctxt *Link)
loadcgo
function
#
func loadcgo(ctxt *Link, file string, pkg string, p string)
loadcgodirectives
method
#
loadcgodirectives reads the previously discovered cgo directives, creating
symbols in preparation for host object loading or use later in the link.
func (ctxt *Link) loadcgodirectives()
loadfips
function
#
loadfips creates the special bracketing symbols and go:fipsinfo.
func loadfips(ctxt *Link)
loadinternal
function
#
func loadinternal(ctxt *Link, name string) *sym.Library
loadlib
method
#
func (ctxt *Link) loadlib()
loadobjfile
function
#
func loadobjfile(ctxt *Link, lib *sym.Library)
logBase2
function
#
logBase2 returns the log in base 2 of a.
func logBase2(a int) uint8
lookupOrDiag
method
#
func (d *dwctxt) lookupOrDiag(n string) loader.Sym
machoCodeSigSym
function
#
machoCodeSigSym creates and returns a symbol for code signature.
The symbol context is left as zeros, which will be generated at the end
(as it depends on the rest of the file).
func machoCodeSigSym(ctxt *Link, codeSize int64) loader.Sym
machoCodeSign
function
#
machoCodeSign code-signs Mach-O file fname with an ad-hoc signature.
This is used for updating an external linker generated binary.
func machoCodeSign(ctxt *Link, fname string) error
machoCombineDwarf
function
#
machoCombineDwarf merges dwarf info generated by dsymutil into a macho executable.
With internal linking, DWARF is embedded into the executable, this lets us do the
same for external linking.
exef is the file of the executable with no DWARF. It must have enough room in the macho
header to add the DWARF sections. (Use ld's -headerpad option)
exem is the macho representation of exef.
dsym is the path to the macho file containing DWARF from dsymutil.
outexe is the path where the combined executable should be saved.
func machoCombineDwarf(ctxt *Link, exef *os.File, exem *macho.File, dsym string, outexe string) error
machoCompressSection
function
#
machoCompressSection compresses secBytes if it results in less data.
func machoCompressSection(sectBytes []byte) (compressed bool, contents []byte, err error)
machoCompressSections
function
#
machoCompressSections tries to compress the DWARF segments in dwarfm,
returning the updated sections and segment contents, nils if the sections
weren't compressed, or an error if there was a problem reading dwarfm.
func machoCompressSections(ctxt *Link, dwarfm *macho.File) ([]*macho.Section, []byte, error)
machoDyldInfo
function
#
Generate data for the dynamic linker, used in LC_DYLD_INFO_ONLY load command.
See mach-o/loader.h, struct dyld_info_command, for the encoding.
e.g. https://opensource.apple.com/source/xnu/xnu-6153.81.5/EXTERNAL_HEADERS/mach-o/loader.h
func machoDyldInfo(ctxt *Link)
machoEmitReloc
function
#
func machoEmitReloc(ctxt *Link)
machoRewriteUuid
function
#
machoRewriteUuid copies over the contents of the Macho executable
exef into the output file outexe, and in the process updates the
LC_UUID command to a new value recomputed from the Go build id.
func machoRewriteUuid(ctxt *Link, exef *os.File, exem *macho.File, outexe string) error
machoShouldExport
function
#
machoShouldExport reports whether a symbol needs to be exported.
When dynamically linking, all non-local variables and plugin-exported
symbols need to be exported.
func machoShouldExport(ctxt *Link, ldr *loader.Loader, s loader.Sym) bool
machoUpdateLoadCommand
function
#
func machoUpdateLoadCommand(r imacho.LoadCmdUpdater, linkseg *macho.Segment, linkoffset uint64, cmd interface{}, fields ...string) error
machoUpdateSections
function
#
func machoUpdateSections(r imacho.LoadCmdUpdater, seg *macho.Segment64, deltaOffset uint64, compressedSects []*macho.Section) error
machoUpdateSegment
function
#
machoUpdateSegment updates the load command for a moved segment.
Only the linkedit segment should move, and it should have 0 sections.
func machoUpdateSegment(r imacho.LoadCmdUpdater, linkseg *macho.Segment, linkoffset uint64) error
machoadddynlib
function
#
func machoadddynlib(lib string, linkmode LinkMode)
machodysymtab
function
#
func machodysymtab(ctxt *Link, base int64)
machofips
function
#
machofips updates go:fipsinfo after external linking
on systems using Mach-O (GOOS=darwin, GOOS=ios).
func machofips(ctxt *Link, exe string, fipso string) error
machorelocsect
function
#
func machorelocsect(ctxt *Link, out *OutBuf, sect *sym.Section, syms []loader.Sym)
machoshbits
function
#
func machoshbits(ctxt *Link, mseg *MachoSeg, sect *sym.Section, segname string)
machosymorder
function
#
func machosymorder(ctxt *Link)
machosymtab
function
#
func machosymtab(ctxt *Link)
machowrite
function
#
func machowrite(ctxt *Link, arch *sys.Arch, out *OutBuf, linkmode LinkMode) int
makeInlSyms
function
#
makeInlSyms returns a map of loader.Sym that are created inlSyms.
func makeInlSyms(ctxt *Link, funcs []loader.Sym, nameOffsets map[loader.Sym]uint32) map[loader.Sym]loader.Sym
makePclntab
function
#
makePclntab makes a pclntab object, and assembles all the compilation units
we'll need to write pclntab. Returns the pclntab structure, a slice of the
CompilationUnits we need, and a slice of the function symbols we need to
generate pclntab.
func makePclntab(ctxt *Link, container loader.Bitmap) (*pclntab, []*sym.CompilationUnit, []loader.Sym)
makeRelocSymState
method
#
makeRelocSymState creates a relocSymState container object to
pass to relocsym(). If relocsym() calls happen in parallel,
each parallel thread should have its own state object.
func (ctxt *Link) makeRelocSymState() *relocSymState
makeRelroForSharedLib
method
#
makeRelroForSharedLib creates a section of readonly data if necessary.
func (state *dodataState) makeRelroForSharedLib(target *Link)
mangleABIName
function
#
Mangle function name with ABI information.
func mangleABIName(ctxt *Link, ldr *loader.Loader, x loader.Sym, name string) string
mangleTypeSym
method
#
mangleTypeSym shortens the names of symbols that represent Go types
if they are visible in the symbol table.
As the names of these symbols are derived from the string of
the type, they can run to many kilobytes long. So we shorten
them using a SHA-1 when the name appears in the final binary.
This also removes characters that upset external linkers.
These are the symbols that begin with the prefix 'type.' and
contain run-time type information used by the runtime and reflect
packages. All Go binaries contain these symbols, but only
those programs loaded dynamically in multiple parts need these
symbols to have entries in the symbol table.
func (ctxt *Link) mangleTypeSym()
mapToPESection
method
#
mapToPESection searches peFile f for s symbol's location.
It returns PE section index, and offset within that section.
func (f *peFile) mapToPESection(ldr *loader.Loader, s loader.Sym, linkmode LinkMode) (pesectidx int, offset int64, err error)
mapinitcleanup
method
#
mapinitcleanup walks all pkg init functions and looks for weak relocations
to mapinit symbols that are no longer reachable. It rewrites
the relocs to target a new no-op routine in the runtime.
func (d *deadcodePass) mapinitcleanup()
mark
method
#
func (d *deadcodePass) mark(symIdx loader.Sym, parent loader.Sym)
markMethod
method
#
func (d *deadcodePass) markMethod(m methodref)
maxSizeTrampolines
function
#
Estimate the max size needed to hold any new trampolines created for this function. This
is used to determine when the section can be split if it becomes too large, to ensure that
the trampolines are in the same section as the function that uses them.
func maxSizeTrampolines(ctxt *Link, ldr *loader.Loader, s loader.Sym, isTramp bool) uint64
mayberemoveoutfile
function
#
* Unix doesn't like it when we write to a running (or, sometimes,
* recently run) binary, so remove the output file before writing it.
* On Windows 7, remove() can force a subsequent create() to fail.
* S_ISREG() does not exist on Plan 9.
func mayberemoveoutfile()
mkArchSym
method
#
mkArchSym is a helper for setArchSyms, to set up a special symbol.
func (ctxt *Link) mkArchSym(name string, ver int, ls *loader.Sym)
mkArchSymVec
method
#
mkArchSymVec is similar to setArchSyms, but operates on elements within
a slice, where each element corresponds to some symbol version.
func (ctxt *Link) mkArchSymVec(name string, ver int, ls []loader.Sym)
mkBuiltinType
method
#
mkBuiltinType populates the dwctxt2 sym lookup maps for the
newly created builtin type DIE 'typeDie'.
func (d *dwctxt) mkBuiltinType(ctxt *Link, abrv int, tname string) *dwarf.DWDie
mkinternaltype
method
#
func (d *dwctxt) mkinternaltype(ctxt *Link, abbrev int, typename string, keyname string, valname string, f func(*dwarf.DWDie)) loader.Sym
mkinternaltypename
function
#
func mkinternaltypename(base string, arg1 string, arg2 string) string
movetomodule
function
#
func movetomodule(ctxt *Link, parent *dwarf.DWDie)
msync
function
#
go:linkname msync syscall.msync
func msync(b []byte, flags int) (err error)
munmap
method
#
func (out *OutBuf) munmap()
munmap
method
#
func (out *OutBuf) munmap()
munmap
method
#
func (out *OutBuf) munmap()
mustFind
method
#
func (d *dwctxt) mustFind(name string) loader.Sym
mustLinkExternal
function
#
mustLinkExternal reports whether the program being linked requires
the external linker be used to complete the link.
func mustLinkExternal(ctxt *Link) (res bool, reason string)
mustSetHeadType
method
#
func (t *Target) mustSetHeadType()
nameFromDIESym
method
#
func (d *dwctxt) nameFromDIESym(dwtypeDIESym loader.Sym) string
needPEBaseReloc
function
#
func needPEBaseReloc(ctxt *Link) bool
newElfPhdr
function
#
func newElfPhdr() *ElfPhdr
newElfShdr
function
#
func newElfShdr(name int64) *ElfShdr
newFipsObj
function
#
newFipsObj creates a fipsObj reading from r and writing to fipso
(unless fipso is the empty string, in which case it writes nowhere
and only computes the hash).
func newFipsObj(r io.ReaderAt, fipso string) (*fipsObj, error)
newMachoLoad
function
#
Create a new Mach-O load command. ndata is the number of 32-bit words for
the data (not including the load command header).
func newMachoLoad(arch *sys.Arch, type_ uint32, ndata uint32) *MachoLoad
newMachoSect
function
#
func newMachoSect(seg *MachoSeg, name string, segname string) *MachoSect
newMachoSeg
function
#
func newMachoSeg(name string, msect int) *MachoSeg
newStackCheck
function
#
func newStackCheck(ctxt *Link, graph bool) *stackCheck
newattr
function
#
newattr attaches a new attribute to the specified DIE.
FIXME: at the moment attributes are stored in a linked list in a
fairly space-inefficient way -- it might be better to instead look
up all attrs in a single large table, then store indices into the
table in the DIE. This would allow us to common up storage for
attributes that are shared by many DIEs (ex: byte size of N).
func newattr(die *dwarf.DWDie, attr uint16, cls int, value int64, data interface{})
newdie
method
#
Every DIE manufactured by the linker has at least an AT_name
attribute (but it will only be written out if it is listed in the abbrev).
The compiler does create nameless DWARF DIEs (ex: concrete subprogram
instance).
FIXME: it would be more efficient to bulk-allocate DIEs.
func (d *dwctxt) newdie(parent *dwarf.DWDie, abbrev int, name string) *dwarf.DWDie
newmemberoffsetattr
function
#
func newmemberoffsetattr(die *dwarf.DWDie, offs int32)
newrefattr
method
#
func (d *dwctxt) newrefattr(die *dwarf.DWDie, attr uint16, ref loader.Sym)
newtype
method
#
func (d *dwctxt) newtype(gotype loader.Sym) *dwarf.DWDie
nextar
function
#
* look for the next file in an archive.
* adapted from libmach.
func nextar(bp *bio.Reader, off int64, a *ArHdr) int64
numPCData
function
#
numPCData returns the number of PCData syms for the FuncInfo.
NB: Preload must be called on valid FuncInfos before calling this function.
func numPCData(ldr *loader.Loader, s loader.Sym, fi loader.FuncInfo) uint32
openbsdTrimLibVersion
function
#
openbsdTrimLibVersion indicates whether a shared library is
versioned and if it is, returns the unversioned name. The
OpenBSD library naming scheme is lib.so..
func openbsdTrimLibVersion(lib string) (string, bool)
pad
method
#
pad adds zeros to the section sect. It writes as many bytes
as necessary to make section sect.SizeOfRawData bytes long.
It assumes that n bytes are already written to the file.
func (sect *peSection) pad(out *OutBuf, n uint32)
passLongArgsInResponseFile
method
#
passLongArgsInResponseFile writes the arguments into a file if they
are very long.
func (ctxt *Link) passLongArgsInResponseFile(argv []string, altLinker string) []string
pclntab
method
#
pclntab generates the pcln table for the link output.
func (ctxt *Link) pclntab(container loader.Bitmap) *pclntab
pdatablk
function
#
func pdatablk(ctxt *Link, out *OutBuf, addr int64, size int64)
peekMachoPlatform
function
#
peekMachoPlatform returns the first LC_VERSION_MIN_* or LC_BUILD_VERSION
load command found in the Mach-O file, if any.
func peekMachoPlatform(m *macho.File) (*MachoPlatformLoad, error)
pefips
function
#
pefips updates go:fipsinfo after external linking
on systems using PE (GOOS=windows).
func pefips(ctxt *Link, exe string, fipso string) error
peimporteddlls
function
#
peimporteddlls returns the gcc command line argument to link all imported
DLLs.
func peimporteddlls() []string
pewrite
function
#
func pewrite(ctxt *Link)
phsh
function
#
func phsh(ph *ElfPhdr, sh *ElfShdr)
pkgname
function
#
func pkgname(ctxt *Link, lib string) string
pop
method
#
func (h *lexHeap) pop(ldr *loader.Loader) loader.Sym
pop
method
#
func (h *heap) pop() loader.Sym
postorder
function
#
func postorder(libs []*sym.Library) []*sym.Library
pruneUndefsForWindows
function
#
pruneUndefsForWindows trims the list "undefs" of currently
outstanding unresolved symbols to remove references to DLL import
symbols (e.g. "__imp_XXX"). In older versions of the linker, we
would just immediately forward references from the import sym
(__imp_XXX) to the DLL sym (XXX), but with newer compilers this
strategy falls down in certain cases. We instead now do this
forwarding later on as a post-processing step, and meaning that
during the middle part of host object loading we can see a lot of
unresolved (SXREF) import symbols. We do not, however, want to
trigger the inclusion of an object from a host archive if the
reference is going to be eventually forwarded to the corresponding
SDYNIMPORT symbol, so here we strip out such refs from the undefs
list.
func pruneUndefsForWindows(ldr *loader.Loader, undefs []loader.Sym, froms []loader.Sym) ([]loader.Sym, []loader.Sym)
purgeSignatureCache
method
#
func (out *OutBuf) purgeSignatureCache()
purgeSignatureCache
method
#
func (out *OutBuf) purgeSignatureCache()
push
method
#
func (h *heap) push(s loader.Sym)
push
method
#
func (h *lexHeap) push(ldr *loader.Loader, s loader.Sym)
putaixsym
function
#
put function used by genasmsym to write symbol table.
func putaixsym(ctxt *Link, x loader.Sym, t SymbolType)
putdie
method
#
func (d *dwctxt) putdie(syms []loader.Sym, die *dwarf.DWDie) []loader.Sym
putelfsectionsym
function
#
func putelfsectionsym(ctxt *Link, out *OutBuf, s loader.Sym, shndx elf.SectionIndex)
putelfstr
function
#
func putelfstr(s string) int
putelfsym
function
#
func putelfsym(ctxt *Link, x loader.Sym, typ elf.SymType, curbind elf.SymBind)
putelfsyment
function
#
func putelfsyment(out *OutBuf, off int, addr int64, size int64, info uint8, shndx elf.SectionIndex, other int)
putplan9sym
function
#
func putplan9sym(ctxt *Link, ldr *loader.Loader, s loader.Sym, char SymbolType)
readArmap
function
#
readArmap reads the archive symbol map.
func readArmap(filename string, f *bio.Reader, arhdr ArHdr) archiveMap
readImportCfg
method
#
func (ctxt *Link) readImportCfg(file string)
readelfsymboldata
function
#
func readelfsymboldata(ctxt *Link, f *elf.File, sym *elf.Symbol) []byte
readnote
function
#
func readnote(f *elf.File, name []byte, typ int32) ([]byte, error)
readwithpad
function
#
func readwithpad(r io.Reader, sz int32) ([]byte, error)
relocSectFn
function
#
relocSectFn wraps the function writing relocations of a section
for parallel execution. Returns the wrapped function and a wait
group for which the caller should wait.
func relocSectFn(ctxt *Link, relocSect func(*Link, *OutBuf, *sym.Section, []loader.Sym)) (func(*Link, *sym.Section, []loader.Sym), *sync.WaitGroup)
relocsym
method
#
relocsym resolve relocations in "s", updating the symbol's content
in "P".
The main loop walks through the list of relocations attached to "s"
and resolves them where applicable. Relocations are often
architecture-specific, requiring calls into the 'archreloc' and/or
'archrelocvariant' functions for the architecture. When external
linking is in effect, it may not be possible to completely resolve
the address/offset for a symbol, in which case the goal is to lay
the groundwork for turning a given relocation into an external reloc
(to be applied by the external linker). For more on how relocations
work in general, see
"Linkers and Loaders", by John R. Levine (Morgan Kaufmann, 1999), ch. 7
This is a performance-critical function for the linker; be careful
to avoid introducing unnecessary allocations in the main loop.
func (st *relocSymState) relocsym(s loader.Sym, P []byte)
report
method
#
func (sc *stackCheck) report(sym loader.Sym, depth int, chain *[]stackCheckChain)
resetAddress
function
#
func resetAddress(ctxt *Link, s loader.Sym)
reverselist
function
#
func reverselist(list **dwarf.DWDie)
reversetree
function
#
func reversetree(list **dwarf.DWDie)
runAtExitFuncs
function
#
runAtExitFuncs runs the queued set of AtExit functions.
func runAtExitFuncs()
secSym
method
#
secSym returns the section symbol for the section.
func (dsi *dwarfSecInfo) secSym() loader.Sym
setArchSyms
method
#
setArchSyms sets up the ArchSyms structure, and must be called before
relocations are applied.
func (ctxt *Link) setArchSyms()
setCarrierSize
function
#
func setCarrierSize(typ sym.SymKind, sz int64)
setCarrierSym
function
#
func setCarrierSym(typ sym.SymKind, s loader.Sym)
setCgoAttr
function
#
Set symbol attributes or flags based on cgo directives.
Any newly discovered HOSTOBJ syms are added to 'hostObjSyms'.
func setCgoAttr(ctxt *Link, file string, pkg string, directives [][]string, hostObjSyms map[loader.Sym]struct{...})
setSymType
method
#
setSymType sets a new override type for 's'.
func (state *dodataState) setSymType(s loader.Sym, kind sym.SymKind)
setpersrc
function
#
func setpersrc(ctxt *Link, syms []loader.Sym)
shsym
function
#
Do not write DT_NULL. elfdynhash will finish it.
func shsym(sh *ElfShdr, ldr *loader.Loader, s loader.Sym)
size
method
#
size returns size of string table t.
func (t *xcoffStringTable) size() int
size
method
#
size returns size of string table t.
func (t *peStringTable) size() int
sizeExtRelocs
function
#
sizeExtRelocs precomputes the size needed for the reloc records,
sets the size and offset for relocation records in each section,
and mmap the output buffer with the proper size.
func sizeExtRelocs(ctxt *Link, relsize uint32)
splitTextSections
function
#
Return whether we may need to split text sections.
On PPC64x, when external linking, a text section should not be
larger than 2^25 bytes due to the size of call target offset field
in the 'bl' instruction. Splitting into smaller text sections
smaller than this limit allows the system linker to modify the long
calls appropriately. The limit allows for the space needed for
tables inserted by the linker.
The same applies to Darwin/ARM64, with 2^27 byte threshold.
Similarly for ARM, we split sections (at 2^25 bytes) to avoid
inconsistencies between the Go linker's reachability calculations
(e.g. will direct call from X to Y need a trampoline) and similar
machinery in the external linker; see #58425 for more on the
history here.
func splitTextSections(ctxt *Link) bool
startProfile
function
#
func startProfile()
stringtouint32
function
#
func stringtouint32(x []uint32, s string)
strput
function
#
func strput(out *OutBuf, s string)
structfieldSize
function
#
func structfieldSize(arch *sys.Arch) int
subSyms
method
#
subSyms returns a list of sub-symbols for the section.
func (dsi *dwarfSecInfo) subSyms() []loader.Sym
substitutetype
method
#
Search children (assumed to have TAG_member) for the one named
field and set its AT_type to dwtype
func (d *dwctxt) substitutetype(structdie *dwarf.DWDie, field string, dwtype loader.Sym)
sum
method
#
sum returns the hash of the fips object file.
func (f *fipsObj) sum() []byte
symName
method
#
func (sc *stackCheck) symName(sym loader.Sym) string
symType
method
#
symType returns the (possibly overridden) type of 's'.
func (state *dodataState) symType(s loader.Sym) sym.SymKind
symalign
function
#
symalign returns the required alignment for the given symbol s.
func symalign(ldr *loader.Loader, s loader.Sym) int32
symbolsAreUnresolved
function
#
symbolsAreUnresolved scans through the loader's list of unresolved
symbols and checks to see whether any of them match the names of the
symbols in 'want'. Return value is a list of bools, with list[K] set
to true if there is an unresolved reference to the symbol in want[K].
func symbolsAreUnresolved(ctxt *Link, want []string) []bool
symkind
function
#
func symkind(ldr *loader.Loader, s loader.Sym) int
symtab
method
#
func (ctxt *Link) symtab(pcln *pclntab) []sym.SymKind
synthesizechantypes
method
#
func (d *dwctxt) synthesizechantypes(ctxt *Link, die *dwarf.DWDie)
synthesizemaptypes
method
#
func (d *dwctxt) synthesizemaptypes(ctxt *Link, die *dwarf.DWDie)
synthesizemaptypesOld
method
#
func (d *dwctxt) synthesizemaptypesOld(ctxt *Link, die *dwarf.DWDie)
synthesizemaptypesSwiss
method
#
func (d *dwctxt) synthesizemaptypesSwiss(ctxt *Link, die *dwarf.DWDie)
synthesizeslicetypes
method
#
func (d *dwctxt) synthesizeslicetypes(ctxt *Link, die *dwarf.DWDie)
synthesizestringtypes
method
#
func (d *dwctxt) synthesizestringtypes(ctxt *Link, die *dwarf.DWDie)
textaddress
method
#
assign addresses to text
func (ctxt *Link) textaddress()
textbuildid
method
#
Add buildid to beginning of text segment, on non-ELF systems.
Non-ELF binary formats are not always flexible enough to
give us a place to put the Go build ID. On those systems, we put it
at the very beginning of the text segment.
This “header” is read by cmd/go.
func (ctxt *Link) textbuildid()
textsectionmap
function
#
Create a table with information on the text sections.
Return the symbol of the table, and number of sections.
func textsectionmap(ctxt *Link) (loader.Sym, uint32)
trampoline
function
#
Detect too-far jumps in function s, and add trampolines if necessary.
ARM, LOONG64, PPC64, PPC64LE and RISCV64 support trampoline insertion for internal
and external linking. On PPC64 and PPC64LE the text sections might be split
but will still insert trampolines where necessary.
func trampoline(ctxt *Link, s loader.Sym)
trimLinkerArgv
function
#
trimLinkerArgv returns a new copy of argv that does not include flags
that are not relevant for testing whether some linker option works.
func trimLinkerArgv(argv []string) []string
typeSymbolMangle
function
#
typeSymbolMangle mangles the given symbol name into something shorter.
Keep the type:. prefix, which parts of the linker (like the
DWARF generator) know means the symbol is not decodable.
Leave type:runtime. symbols alone, because other parts of
the linker manipulates them.
func typeSymbolMangle(name string) string
typelink
method
#
typelink generates the typelink table which is used by reflect.typelinks().
Types that should be added to the typelinks table are marked with the
MakeTypelink attribute by the compiler.
func (ctxt *Link) typelink()
uncommonSize
function
#
func uncommonSize(arch *sys.Arch) int
updatePreviousFile
method
#
Update values for the previous package.
- Svalue of the C_FILE symbol: if it is the last one, this Svalue must be -1
- Xsclen of the csect symbol.
func (f *xcoffFile) updatePreviousFile(ctxt *Link, last bool)
usage
function
#
func usage()
uuidFromGoBuildId
function
#
uuidFromGoBuildId hashes the Go build ID and returns a slice of 16
bytes suitable for use as the payload in a Macho LC_UUID load
command.
func uuidFromGoBuildId(buildID string) []byte
walkFilenames
function
#
walkFilenames walks funcs, calling a function for each filename used in each
function's line table.
func walkFilenames(ctxt *Link, funcs []loader.Sym, f func(*sym.CompilationUnit, goobj.CUFileIndex))
walkFuncs
function
#
walkFuncs iterates over the funcs, calling a function for each unique
function and inlined function.
func walkFuncs(ctxt *Link, funcs []loader.Sym, f func(loader.Sym))
walksymtypedef
method
#
func (d *dwctxt) walksymtypedef(symIdx loader.Sym) loader.Sym
walktypedef
function
#
func walktypedef(die *dwarf.DWDie) *dwarf.DWDie
windynrelocsym
function
#
windynrelocsym examines a text symbol 's' and looks for relocations
from it that correspond to references to symbols defined in DLLs,
then fixes up those relocations as needed. A reference to a symbol
XYZ from some DLL will fall into one of two categories: an indirect
ref via "__imp_XYZ", or a direct ref to "XYZ". Here's an example of
an indirect ref (this is an excerpt from objdump -ldr):
1c1: 48 89 c6 movq %rax, %rsi
1c4: ff 15 00 00 00 00 callq *(%rip)
00000000000001c6: IMAGE_REL_AMD64_REL32 __imp__errno
In the assembly above, the code loads up the value of __imp_errno
and then does an indirect call to that value.
Here is what a direct reference might look like:
137: e9 20 06 00 00 jmp 0x75c
13c: e8 00 00 00 00 callq 0x141
000000000000013d: IMAGE_REL_AMD64_REL32 _errno
The assembly below dispenses with the import symbol and just makes
a direct call to _errno.
The code below handles indirect refs by redirecting the target of
the relocation from "__imp_XYZ" to "XYZ" (since the latter symbol
is what the Windows loader is expected to resolve). For direct refs
the call is redirected to a stub, where the stub first loads the
symbol and then direct an indirect call to that value.
Note that for a given symbol (as above) it is perfectly legal to
have both direct and indirect references.
func windynrelocsym(ctxt *Link, rel *loader.SymbolBuilder, s loader.Sym) error
windynrelocsyms
method
#
windynrelocsyms generates jump table to C library functions that will be
added later. windynrelocsyms writes the table into .rel symbol.
func (ctxt *Link) windynrelocsyms()
write
method
#
write writes XCOFF section sect into the output file.
func (sect *XcoffScnHdr64) write(ctxt *Link)
write
method
#
write writes string table t into the output file.
func (t *peStringTable) write(out *OutBuf)
write
method
#
write writes COFF section sect into the output file.
func (sect *peSection) write(out *OutBuf, linkmode LinkMode) error
write
method
#
write writes string table t into the output file.
func (t *xcoffStringTable) write(out *OutBuf)
write
method
#
func (rt *peBaseRelocTable) write(ctxt *Link)
writeBlock
function
#
func writeBlock(ctxt *Link, out *OutBuf, ldr *loader.Loader, syms []loader.Sym, addr int64, size int64, pad []byte)
writeBlocks
function
#
writeBlocks writes a specified chunk of symbols to the output buffer. It
breaks the write up into ≥blockSize chunks to write them out, and schedules
as many goroutines as necessary to accomplish this task. This call then
blocks, waiting on the writes to complete. Note that we use the sem parameter
to limit the number of concurrent writes taking place.
func writeBlocks(ctxt *Link, out *OutBuf, sem chan int, ldr *loader.Loader, syms []loader.Sym, addr int64, size int64, pad []byte)
writeByte
method
#
func (p *GCProg) writeByte() (func(x byte))
writeDatblkToOutBuf
function
#
func writeDatblkToOutBuf(ctxt *Link, out *OutBuf, addr int64, size int64)
writeDirFileTables
method
#
writeDirFileTables emits the portion of the DWARF line table
prologue containing the include directories and file names,
described in section 6.2.4 of the DWARF 4 standard. It walks the
filepaths for the unit to discover any common directories, which
are emitted to the directory table first, then the file table is
emitted after that.
func (d *dwctxt) writeDirFileTables(unit *sym.CompilationUnit, lsu *loader.SymbolBuilder)
writeFuncs
function
#
writeFuncs writes the func structures and pcdata to runtime.functab.
func writeFuncs(ctxt *Link, sb *loader.SymbolBuilder, funcs []loader.Sym, inlSyms map[loader.Sym]loader.Sym, startLocations []uint32, cuOffsets []uint32, nameOffsets map[loader.Sym]uint32)
writeGDBLinkerScript
function
#
writeGDBLinkerScript creates gcc linker script file in temp
directory. writeGDBLinkerScript returns created file path.
The script is used to work around gcc bug
(see https://golang.org/issue/20183 for details).
func writeGDBLinkerScript() string
writeLdrScn
method
#
func (f *xcoffFile) writeLdrScn(ctxt *Link, globalOff uint64)
writeLoc
method
#
writeLoc determines the write location if a buffer is mmaped.
We maintain two write buffers, an mmapped section, and a heap section for
writing. When the mmapped section is full, we switch over the heap memory
for writing.
func (out *OutBuf) writeLoc(lenToWrite int64) (int64, []byte)
writePCToFunc
function
#
writePCToFunc writes the PC->func lookup table.
func writePCToFunc(ctxt *Link, sb *loader.SymbolBuilder, funcs []loader.Sym, startLocations []uint32)
writeParallel
function
#
writeParallel handles scheduling parallel execution of data write functions.
func writeParallel(wg *sync.WaitGroup, fn writeFn, ctxt *Link, seek uint64, vaddr uint64, length uint64)
writeSEH
function
#
func writeSEH(ctxt *Link)
writeSEHAMD64
function
#
func writeSEHAMD64(ctxt *Link)
writeSymbol
method
#
writeSymbol appends symbol s to file f symbol table.
It also sets s.Dynid to written symbol number.
func (f *peFile) writeSymbol(out *OutBuf, ldr *loader.Loader, s loader.Sym, name string, value int64, sectidx int, typ uint16, class uint8)
writeSymbolFunc
method
#
Write symbol representing a .text function.
The symbol table is split with C_FILE corresponding to each package
and not to each source file as it should be.
func (f *xcoffFile) writeSymbolFunc(ctxt *Link, x loader.Sym) []xcoffSym
writeSymbolNewFile
method
#
Write symbols needed when a new file appeared:
- a C_FILE with one auxiliary entry for its name
- C_DWARF symbols to provide debug information
- a C_HIDEXT which will be a csect containing all of its functions
It needs several parameters to create .csect symbols such as its entry point and its section number.
Currently, a new file is in fact a new package. It seems to be OK, but it might change
in the future.
func (f *xcoffFile) writeSymbolNewFile(ctxt *Link, name string, firstEntry uint64, extnum int16)
writeSymbolTableAndStringTable
method
#
writeSymbolTableAndStringTable writes out symbol and string tables for peFile f.
func (f *peFile) writeSymbolTableAndStringTable(ctxt *Link)
writeSymbols
method
#
writeSymbols writes all COFF symbol table records.
func (f *peFile) writeSymbols(ctxt *Link)
writeUnitInfo
method
#
func (d *dwctxt) writeUnitInfo(u *sym.CompilationUnit, abbrevsym loader.Sym, infoEpilog loader.Sym) []loader.Sym
writeabbrev
method
#
func (d *dwctxt) writeabbrev() dwarfSecInfo
writeframes
method
#
func (d *dwctxt) writeframes(fs loader.Sym) dwarfSecInfo
writegdbscript
method
#
func (d *dwctxt) writegdbscript() dwarfSecInfo
writelines
method
#
writelines collects up and chains together the symbols needed to
form the DWARF line table for the specified compilation unit,
returning a list of symbols. The returned list will include an
initial symbol containing the line table header and prologue (with
file table), then a series of compiler-emitted line table symbols
(one per live function), and finally an epilog symbol containing an
end-of-sequence operator. The prologue and epilog symbols are passed
in (having been created earlier); here we add content to them.
func (d *dwctxt) writelines(unit *sym.CompilationUnit, lineProlog loader.Sym) []loader.Sym
writepcranges
method
#
writepcranges generates the DW_AT_ranges table for compilation unit
"unit", and returns a collection of ranges symbols (one for the
compilation unit DIE itself and the remainder from functions in the unit).
func (d *dwctxt) writepcranges(unit *sym.CompilationUnit, base loader.Sym, pcs []dwarf.Range, rangeProlog loader.Sym) []loader.Sym
xcoffAlign
function
#
xcoffAlign returns the log base 2 of the symbol's alignment.
func xcoffAlign(ldr *loader.Loader, x loader.Sym, t SymbolType) uint8
xcoffCreateExportFile
function
#
xcoffCreateExportFile creates a file with exported symbols for
-Wl,-bE option.
ld won't export symbols unless they are listed in an export file.
func xcoffCreateExportFile(ctxt *Link) (fname string)
xcoffGetDwarfSubtype
function
#
xcoffGetDwarfSubtype returns the XCOFF name of the DWARF section str
and its subtype constant.
func xcoffGetDwarfSubtype(str string) (string, uint32)
xcoffUpdateOuterSize
function
#
xcoffUpdateOuterSize stores the size of outer symbols in order to have it
in the symbol table.
func xcoffUpdateOuterSize(ctxt *Link, size int64, stype sym.SymKind)
xcoffwrite
function
#
func xcoffwrite(ctxt *Link)
xdatablk
function
#
func xdatablk(ctxt *Link, out *OutBuf, addr int64, size int64)
xdefine
method
#
func (ctxt *Link) xdefine(p string, t sym.SymKind, v int64) loader.Sym