aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/link/internal/ld/deadcode.go
diff options
context:
space:
mode:
authorCherry Zhang <cherryyz@google.com>2019-09-24 17:31:12 -0400
committerCherry Zhang <cherryyz@google.com>2019-10-09 16:05:40 +0000
commit24950952759cb26144333b0a47eae7da44808eec (patch)
tree9246ba38dca5990ab0208443b88626c3e3f79a1f /src/cmd/link/internal/ld/deadcode.go
parent48151b3f0ffda8a38ca71c8f1b8a72d5f90d7061 (diff)
downloadgo-24950952759cb26144333b0a47eae7da44808eec.tar.xz
[dev.link] cmd/link: load full symbol contents after deadcode pass
If the new object file format is used, now we load full symbol contents after the deadcode pass, for reachable symbols only. We still load some informations early, like relocations and the contents of type symbols, which are used in the deadcode pass. If we rewrite deadcode to use index directly, we could delay more of the loading (to sym.Symbol), and perhaps delay the creation of sym.Symbol. TODO: internal linking with host objects doesn't work yet. Change-Id: I7d4880e8f150e8709ffac277e62191623440e4cf Reviewed-on: https://go-review.googlesource.com/c/go/+/197258 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
Diffstat (limited to 'src/cmd/link/internal/ld/deadcode.go')
-rw-r--r--src/cmd/link/internal/ld/deadcode.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/cmd/link/internal/ld/deadcode.go b/src/cmd/link/internal/ld/deadcode.go
index cadb92b43c..575fabc259 100644
--- a/src/cmd/link/internal/ld/deadcode.go
+++ b/src/cmd/link/internal/ld/deadcode.go
@@ -60,8 +60,8 @@ func deadcode(ctxt *Link) {
d.init()
d.flood()
- callSym := ctxt.Syms.ROLookup("reflect.Value.Call", sym.SymVerABIInternal)
- methSym := ctxt.Syms.ROLookup("reflect.Value.Method", sym.SymVerABIInternal)
+ callSym := ctxt.Lookup("reflect.Value.Call", sym.SymVerABIInternal)
+ methSym := ctxt.Lookup("reflect.Value.Method", sym.SymVerABIInternal)
reflectSeen := false
if ctxt.DynlinkingGo() {
@@ -283,7 +283,7 @@ func (d *deadcodepass) init() {
// We don't keep the go.plugin.exports symbol,
// but we do keep the symbols it refers to.
- exports := d.ctxt.Syms.ROLookup("go.plugin.exports", 0)
+ exports := d.ctxt.Lookup("go.plugin.exports", 0)
if exports != nil {
for i := range exports.R {
d.mark(exports.R[i].Sym, nil)
@@ -298,9 +298,9 @@ func (d *deadcodepass) init() {
for _, name := range names {
// Mark symbol as an data/ABI0 symbol.
- d.mark(d.ctxt.Syms.ROLookup(name, 0), nil)
+ d.mark(d.ctxt.Lookup(name, 0), nil)
// Also mark any Go functions (internal ABI).
- d.mark(d.ctxt.Syms.ROLookup(name, sym.SymVerABIInternal), nil)
+ d.mark(d.ctxt.Lookup(name, sym.SymVerABIInternal), nil)
}
}