aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/link/internal/ld/deadcode.go
diff options
context:
space:
mode:
authorDavid Crawshaw <crawshaw@golang.org>2016-09-24 08:39:31 +1000
committerDavid Crawshaw <crawshaw@golang.org>2016-11-03 14:07:34 +0000
commit8eb9fdaa0123fc98cb70f58801eb74c8a6f92817 (patch)
tree51b8d1e7810c3aef0e05da0f62cc1803eb480ff1 /src/cmd/link/internal/ld/deadcode.go
parent5ac3e7d6a7717bf2f722803e1852ba991af4e724 (diff)
downloadgo-8eb9fdaa0123fc98cb70f58801eb74c8a6f92817.tar.xz
cmd/compile: write type symbols referenced in ptabs
The exported symbol for a plugin can be the only reference to a type in a program. In particular, "var F func()" will have the type *func(), which is uncommon. Fixes #17140 Change-Id: Ide2104edbf087565f5377374057ae54e0c00c57e Reviewed-on: https://go-review.googlesource.com/29692 Run-TryBot: David Crawshaw <crawshaw@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/cmd/link/internal/ld/deadcode.go')
-rw-r--r--src/cmd/link/internal/ld/deadcode.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cmd/link/internal/ld/deadcode.go b/src/cmd/link/internal/ld/deadcode.go
index ac64813228..335d9849c9 100644
--- a/src/cmd/link/internal/ld/deadcode.go
+++ b/src/cmd/link/internal/ld/deadcode.go
@@ -290,6 +290,11 @@ func (d *deadcodepass) flood() {
}
if strings.HasPrefix(s.Name, "type.") && s.Name[5] != '.' {
+ if len(s.P) == 0 {
+ // Probably a bug. The undefined symbol check
+ // later will give a better error than deadcode.
+ continue
+ }
if decodetypeKind(s)&kindMask == kindInterface {
for _, sig := range decodeIfaceMethods(d.ctxt.Arch, s) {
if d.ctxt.Debugvlog > 1 {