go: github.com/golang/go/src/cmd/link/internal/loader Index | Files

package loader

import "github.com/golang/go/src/cmd/link/internal/loader"

Index

Package Files

loader.go

Constants

const (
    // Loader.flags
    FlagStrictDups = 1 << iota
)

type Loader Uses

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 NewLoader Uses

func NewLoader(flags uint32) *Loader

func (*Loader) AddExtSym Uses

func (l *Loader) AddExtSym(name string, ver int) Sym

Add an external symbol (without index). Return the index of newly added symbol, or 0 if not added.

func (*Loader) AddSym Uses

func (l *Loader) AddSym(name string, ver int, i Sym, r *oReader, dupok bool, typ sym.SymKind) bool

Add a symbol with a given index, return if it is added.

func (*Loader) AuxSym Uses

func (l *Loader) AuxSym(i Sym, j int) Sym

Returns the referred symbol of the j-th aux symbol of the i-th symbol.

func (*Loader) Create Uses

func (l *Loader) Create(name string, syms *sym.Symbols) *sym.Symbol

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) Data Uses

func (l *Loader) Data(i Sym) []byte

Returns the symbol content of the i-th symbol. i is global index.

func (*Loader) Dump Uses

func (l *Loader) Dump()

For debugging.

func (*Loader) ExtractSymbols Uses

func (l *Loader) ExtractSymbols(syms *sym.Symbols)

ExtractSymbols grabs the symbols out of the loader for work that hasn't been ported to the new symbol type.

func (*Loader) InitReachable Uses

func (l *Loader) InitReachable()

Initialize Reachable bitmap for running deadcode pass.

func (*Loader) IsDup Uses

func (l *Loader) IsDup(i Sym) bool

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 Uses

func (l *Loader) IsExternal(i Sym) bool

func (*Loader) IsGoType Uses

func (l *Loader) IsGoType(i Sym) bool

Returns whether this is a Go type symbol.

func (l *Loader) IsItabLink(i Sym) bool

Returns whether this is a "go.itablink.*" symbol.

func (*Loader) IsReflectMethod Uses

func (l *Loader) IsReflectMethod(i Sym) bool

Returns whether the i-th symbol has ReflectMethod attribute set.

func (*Loader) LoadFull Uses

func (l *Loader) LoadFull(arch *sys.Arch, syms *sym.Symbols)

Load full contents.

func (*Loader) LoadRefs Uses

func (l *Loader) LoadRefs(arch *sys.Arch, syms *sym.Symbols)

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 Uses

func (l *Loader) LoadSymbol(name string, version int, syms *sym.Symbols) *sym.Symbol

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 Uses

func (l *Loader) Lookup(name string, ver int) Sym

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 Uses

func (l *Loader) LookupOrCreate(name string, version int, syms *sym.Symbols) *sym.Symbol

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) NAux Uses

func (l *Loader) NAux(i Sym) int

Returns the number of aux symbols given a global index.

func (*Loader) NDef Uses

func (l *Loader) NDef() int

Number of defined Go symbols.

func (*Loader) NStrictDupMsgs Uses

func (l *Loader) NStrictDupMsgs() int

func (*Loader) NSym Uses

func (l *Loader) NSym() int

Number of total symbols.

func (*Loader) OuterSym Uses

func (l *Loader) OuterSym(i Sym) Sym

OuterSym gets the outer symbol for host object loaded symbols.

func (*Loader) Preload Uses

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 Uses

func (l *Loader) RawSymName(i Sym) string

Returns the raw (unpatched) name of the i-th symbol.

func (*Loader) ReadAuxSyms Uses

func (l *Loader) ReadAuxSyms(symIdx Sym, dst []Sym) []Sym

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.

func (*Loader) Relocs Uses

func (l *Loader) Relocs(i Sym) Relocs

Relocs returns a Relocs object for the given global sym.

func (*Loader) SubSym Uses

func (l *Loader) SubSym(i Sym) Sym

SubSym gets the subsymbol for host object loaded symbols.

func (*Loader) SymAttr Uses

func (l *Loader) SymAttr(i Sym) uint8

Returns the attributes of the i-th symbol.

func (*Loader) SymName Uses

func (l *Loader) SymName(i Sym) string

Returns the (patched) name of the i-th symbol.

func (*Loader) SymType Uses

func (l *Loader) SymType(i Sym) sym.SymKind

Returns the type of the i-th symbol.

type Reloc Uses

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 Uses

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.

func (*Relocs) At Uses

func (relocs *Relocs) At(j int) Reloc

At method returns the j-th reloc for a global symbol.

func (*Relocs) ReadAll Uses

func (relocs *Relocs) ReadAll(dst []Reloc) []Reloc

ReadAll method reads all relocations for a symbol into the specified slice. If the slice capacity is not large enough, a new larger slice will be allocated. Final slice is returned.

type Sym Uses

type Sym int

Sym encapsulates a global symbol index, used to identify a specific Go symbol. The 0-valued Sym is corresponds to an invalid symbol.

Package loader imports 14 packages (graph). Updated 2019-12-09. Refresh now. Tools for package owners.

The go get command cannot install this package because of the following issues: