]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.link] cmd/link: clean up unused function and arguments
authorCherry Zhang <cherryyz@google.com>
Wed, 12 Feb 2020 22:50:21 +0000 (17:50 -0500)
committerCherry Zhang <cherryyz@google.com>
Thu, 13 Feb 2020 15:47:21 +0000 (15:47 +0000)
Change-Id: Idacb027c5ae11e029ee4ab10f6c9a76ff435e5b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/219228
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
src/cmd/link/internal/ld/lib.go
src/cmd/link/internal/loader/loader.go

index fd43dd488552a721b650b983a6eaccdc7ceb0b80..deafb5cae623e3296bb63907d14c718584ff848e 100644 (file)
@@ -446,7 +446,7 @@ func (ctxt *Link) loadlib() {
        }
 
        // Add non-package symbols and references of externally defined symbols.
-       ctxt.loader.LoadNonpkgSyms(ctxt.Arch, ctxt.Syms)
+       ctxt.loader.LoadNonpkgSyms(ctxt.Syms)
 
        // Load symbols from shared libraries, after all Go object symbols are loaded.
        for _, lib := range ctxt.Library {
@@ -1815,7 +1815,7 @@ func ldobj(ctxt *Link, f *bio.Reader, lib *sym.Library, length int64, pn string,
        ldpkg(ctxt, f, lib, import1-import0-2, pn) // -2 for !\n
        f.MustSeek(import1, 0)
 
-       ctxt.loader.Preload(ctxt.Arch, ctxt.Syms, f, lib, unit, eof-f.Offset(), pn, 0)
+       ctxt.loader.Preload(ctxt.Syms, f, lib, unit, eof-f.Offset(), 0)
        addImports(ctxt, lib, pn)
        return nil
 }
index b80f2c568b83698c5924bbf72ef330aaf67fa710..1dcbf503c954840ac20865bc4f0650aa8c7053b9 100644 (file)
@@ -1476,7 +1476,7 @@ func (x RelocByOff) Less(i, j int) bool { return x[i].Off < x[j].Off }
 // Preload a package: add autolibs, add defined package symbols to the symbol table.
 // Does not add non-package symbols yet, which will be done in LoadNonpkgSyms.
 // Does not read symbol data.
-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) {
+func (l *Loader) Preload(syms *sym.Symbols, f *bio.Reader, lib *sym.Library, unit *sym.CompilationUnit, length int64, flags int) {
        roObject, readonly, err := f.Slice(uint64(length))
        if err != nil {
                log.Fatal("cannot read object file:", err)
@@ -1554,16 +1554,16 @@ func (l *Loader) preloadSyms(r *oReader, kind int) {
 
 // Add non-package symbols and references to external symbols (which are always
 // named).
-func (l *Loader) LoadNonpkgSyms(arch *sys.Arch, syms *sym.Symbols) {
+func (l *Loader) LoadNonpkgSyms(syms *sym.Symbols) {
        for _, o := range l.objs[1:] {
                l.preloadSyms(o.r, nonPkgDef)
        }
        for _, o := range l.objs[1:] {
-               loadObjRefs(l, o.r, arch, syms)
+               loadObjRefs(l, o.r, syms)
        }
 }
 
-func loadObjRefs(l *Loader, r *oReader, arch *sys.Arch, syms *sym.Symbols) {
+func loadObjRefs(l *Loader, r *oReader, syms *sym.Symbols) {
        ndef := r.NSym() + r.NNonpkgdef()
        for i, n := 0, r.NNonpkgref(); i < n; i++ {
                osym := goobj2.Sym{}
@@ -1834,14 +1834,6 @@ type funcAllocInfo struct {
        fdOff   uint32 // number of int64's needed in all Funcdataoff slices
 }
 
-// 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 (l *Loader) LookupOrCreate(name string, version int) *sym.Symbol {
-       panic("unreachable") // TODO: delete once PE loader is converted
-}
-
 // cloneToExternal takes the existing object file symbol (symIdx)
 // and creates a new external symbol payload that is a clone with
 // respect to name, version, type, relocations, etc. The idea here