go/src/cmd/link/internal/ld/lib.go

type ArchSyms

// mkArchSym is a helper for setArchSyms, to set up a special symbol.
func (ctxt *Link) mkArchSym(name string, ver int, ls *loader.Sym) {}

// 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) {}

// setArchSyms sets up the ArchSyms structure, and must be called before
// relocations are applied.
func (ctxt *Link) setArchSyms() {}

type Arch

var thearch

var lcSize

var rpath

var spSize

var symSize

var abiInternalVer

// DynlinkingGo reports whether we are producing Go code that can live
// in separate shared libraries linked together at runtime.
func (ctxt *Link) DynlinkingGo() bool {}

// CanUsePlugins reports whether a plugins can be used
func (ctxt *Link) CanUsePlugins() bool {}

// NeedCodeSign reports whether we need to code-sign the output binary.
func (ctxt *Link) NeedCodeSign() bool {}

var dynlib

var ldflag

var havedynamic

var Funcalign

var iscgo

var elfglobalsymndx

var interpreter

var debug_s

var HEADR

var nerrors

var liveness

var checkStrictDups

var strictDupMsgCount

var Segtext

var Segrodata

var Segrelrodata

var Segdata

var Segdwarf

var Segpdata

var Segxdata

var Segments

const pkgdef

var externalobj

var dynimportfail

var preferlinkext

var unknownObjFormat

var theline

func Lflag(ctxt *Link, arg string) {}

/*
 * 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() {}

func libinit(ctxt *Link) {}

func exitIfErrors() {}

func errorexit() {}

func loadinternal(ctxt *Link, name string) *sym.Library {}

// extld returns the current external linker.
func (ctxt *Link) extld() []string {}

// 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, libname string) string {}

// findLibPath searches for library libname.
// It returns library full path if found, or "none" if not found.
func (ctxt *Link) findLibPath(libname string) string {}

func (ctxt *Link) loadlib() {}

// 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) {}

// 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() {}

// Set up flags and special symbols depending on the platform build mode.
// This version works with loader.Loader.
func (ctxt *Link) linksetup() {}

// 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() {}

// 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 {}

/*
 * look for the next file in an archive.
 * adapted from libmach.
 */
func nextar(bp *bio.Reader, off int64, a *ArHdr) int64 {}

func loadobjfile(ctxt *Link, lib *sym.Library) {}

type Hostobj

var hostobj

var internalpkg

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 {}

func hostobjs(ctxt *Link) {}

func hostlinksetup(ctxt *Link) {}

// 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) {}

// hostobjCopy creates a copy of the object files in hostobj in a
// temporary directory.
func (ctxt *Link) hostobjCopy() (paths []string) {}

// 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 {}

type machoUpdateFunc

// archive builds a .a archive from the hostobj object files.
func (ctxt *Link) archive() {}

func (ctxt *Link) hostlink() {}

// passLongArgsInResponseFile writes the arguments into a file if they
// are very long.
func (ctxt *Link) passLongArgsInResponseFile(argv []string, altLinker string) []string {}

var createTrivialCOnce

func linkerFlagSupported(arch *sys.Arch, linker, altLinker, flag string) bool {}

// 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 {}

// hostlinkArchArgs returns arguments to pass to the external linker
// based on the architecture.
func hostlinkArchArgs(arch *sys.Arch) []string {}

var wantHdr

// 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 {}

// 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 {}

// 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) {}

func checkFingerprint(lib *sym.Library, libfp goobj.FingerprintType, src string, srcfp goobj.FingerprintType) {}

func readelfsymboldata(ctxt *Link, f *elf.File, sym *elf.Symbol) []byte {}

func readwithpad(r io.Reader, sz int32) ([]byte, error) {}

func readnote(f *elf.File, name []byte, typ int32) ([]byte, error) {}

func findshlib(ctxt *Link, shlib string) string {}

func ldshlibsyms(ctxt *Link, shlib string) {}

func addsection(ldr *loader.Loader, arch *sys.Arch, seg *sym.Segment, name string, rwx int) *sym.Section {}

func usage() {}

type SymbolType

const TextSym

const DataSym

const BSSSym

const UndefinedSym

const TLSSym

const FrameSym

const ParamSym

const AutoSym

const DeletedAutoSym

// defineInternal defines a symbol used internally by the go runtime.
func (ctxt *Link) defineInternal(p string, t sym.SymKind) loader.Sym {}

func (ctxt *Link) xdefine(p string, t sym.SymKind, v int64) loader.Sym {}

func datoff(ldr *loader.Loader, s loader.Sym, addr int64) int64 {}

func Entryvalue(ctxt *Link) int64 {}

func (ctxt *Link) callgraph() {}

func Rnd(v int64, r int64) int64 {}

func bgetc(r *bio.Reader) int {}

type markKind

const _

const visiting

const visited

func postorder(libs []*sym.Library) []*sym.Library {}

func dfs(lib *sym.Library, mark map[*sym.Library]markKind, order *[]*sym.Library) {}

func ElfSymForReloc(ctxt *Link, s loader.Sym) int32 {}

func AddGotSym(target *Target, ldr *loader.Loader, syms *ArchSyms, s loader.Sym, elfRelocTyp uint32) {}

var hostobjcounter

// 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) {}

// 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 {}