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>
This commit is contained in:
David Crawshaw 2016-09-24 08:39:31 +10:00
parent 5ac3e7d6a7
commit 8eb9fdaa01
4 changed files with 21 additions and 1 deletions

View file

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