Documentation ¶
Index ¶
- Constants
- type Loader
- func (l *Loader) AddExtSym(name string, ver int) Sym
- func (l *Loader) AddSym(name string, ver int, i Sym, r *oReader, dupok bool, typ sym.SymKind) bool
- func (l *Loader) AuxSym(i Sym, j int) Sym
- func (l *Loader) Create(name string, syms *sym.Symbols) *sym.Symbol
- func (l *Loader) Data(i Sym) []byte
- func (l *Loader) Dump()
- func (l *Loader) ExtractSymbols(syms *sym.Symbols)
- func (l *Loader) InitReachable()
- func (l *Loader) IsDup(i Sym) bool
- func (l *Loader) IsExternal(i Sym) bool
- func (l *Loader) IsGoType(i Sym) bool
- func (l *Loader) IsItabLink(i Sym) bool
- func (l *Loader) IsReflectMethod(i Sym) bool
- func (l *Loader) LoadFull(arch *sys.Arch, syms *sym.Symbols)
- func (l *Loader) LoadRefs(arch *sys.Arch, syms *sym.Symbols)
- func (l *Loader) LoadSymbol(name string, version int, syms *sym.Symbols) *sym.Symbol
- func (l *Loader) Lookup(name string, ver int) Sym
- func (l *Loader) LookupOrCreate(name string, version int, syms *sym.Symbols) *sym.Symbol
- func (l *Loader) NAux(i Sym) int
- func (l *Loader) NDef() int
- func (l *Loader) NStrictDupMsgs() int
- func (l *Loader) NSym() int
- func (l *Loader) OuterSym(i Sym) Sym
- func (l *Loader) Preload(arch *sys.Arch, syms *sym.Symbols, f *bio.Reader, lib *sym.Library, ...)
- func (l *Loader) RawSymName(i Sym) string
- func (l *Loader) ReadAuxSyms(symIdx Sym, dst []Sym) []Sym
- func (l *Loader) Relocs(i Sym) Relocs
- func (l *Loader) SubSym(i Sym) Sym
- func (l *Loader) SymAttr(i Sym) uint8
- func (l *Loader) SymName(i Sym) string
- func (l *Loader) SymType(i Sym) sym.SymKind
- type Reloc
- type Relocs
- type Sym
Constants ¶
const ( // Loader.flags FlagStrictDups = 1 << iota )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Loader ¶
type Loader struct { Syms []*sym.Symbol // indexed symbols. XXX we still make sym.Symbol for now. Reachable bitmap // bitmap of reachable symbols, indexed by global index // Used to implement field tracking; created during deadcode if // field tracking is enabled. Reachparent[K] contains the index of // the symbol that triggered the marking of symbol K as live. Reachparent []Sym // contains filtered or unexported fields }
A Loader loads new object files and resolves indexed symbol references.
func (*Loader) AddExtSym ¶
Add an external symbol (without index). Return the index of newly added symbol, or 0 if not added.
func (*Loader) Create ¶
Create creates a symbol with the specified name, returning a sym.Symbol object for it. This method is intended for static/hidden symbols discovered while loading host objects. We can see more than one instance of a given static symbol with the same name/version, so we can't add them to the lookup tables "as is". Instead assign them fictitious (unique) versions, starting at -1 and decreasing by one for each newly created symbol, and record them in the extStaticSyms hash.
func (*Loader) ExtractSymbols ¶
ExtractSymbols grabs the symbols out of the loader for work that hasn't been ported to the new symbol type.
func (*Loader) InitReachable ¶
func (l *Loader) InitReachable()
Initialize Reachable bitmap for running deadcode pass.
func (*Loader) IsDup ¶
Returns whether i is a dup of another symbol, and i is not "primary", i.e. Lookup i by name will not return i.
func (*Loader) IsExternal ¶
func (*Loader) IsItabLink ¶
Returns whether this is a "go.itablink.*" symbol.
func (*Loader) IsReflectMethod ¶
Returns whether the i-th symbol has ReflectMethod attribute set.
func (*Loader) LoadRefs ¶
Make sure referenced symbols are added. Most of them should already be added. This should only be needed for referenced external symbols.
func (*Loader) LoadSymbol ¶
LoadSymbol loads a single symbol by name. This function should only be used by the host object loaders. NB: This function does NOT set the symbol as reachable.
func (*Loader) Lookup ¶
Look up a symbol by name, return global index, or 0 if not found. This is more like Syms.ROLookup than Lookup -- it doesn't create new symbol.
func (*Loader) LookupOrCreate ¶
LookupOrCreate looks up a symbol by name, and creates one if not found. Either way, it will also create a sym.Symbol for it, if not already. This should only be called when interacting with parts of the linker that still works on sym.Symbols (i.e. internal cgo linking, for now).
func (*Loader) NStrictDupMsgs ¶
func (*Loader) Preload ¶
func (l *Loader) Preload(arch *sys.Arch, syms *sym.Symbols, f *bio.Reader, lib *sym.Library, unit *sym.CompilationUnit, length int64, pn string, flags int)
Preload a package: add autolibs, add symbols to the symbol table. Does not read symbol data yet.
func (*Loader) RawSymName ¶
Returns the raw (unpatched) name of the i-th symbol.
func (*Loader) ReadAuxSyms ¶
ReadAuxSyms reads the aux symbol ids for the specified symbol into the slice passed as a parameter. If the slice capacity is not large enough, a new larger slice will be allocated. Final slice is returned.
type Reloc ¶
type Reloc struct { Off int32 // offset to rewrite Size uint8 // number of bytes to rewrite: 0, 1, 2, or 4 Type objabi.RelocType // the relocation type Add int64 // addend Sym Sym // global index of symbol the reloc addresses }
Reloc contains the payload for a specific relocation. TODO: replace this with sym.Reloc, once we change the relocation target from "*sym.Symbol" to "loader.Sym" in sym.Reloc.
type Relocs ¶
type Relocs struct { Count int // number of relocs // contains filtered or unexported fields }
Relocs encapsulates the set of relocations on a given symbol; an instance of this type is returned by the Loader Relocs() method.