cmd/link: do not mark go.plugin.tabs as reachable in non-plugins

Fixes #18250

Change-Id: I4f61591356ddb4a906c206ad8456d1839daf7b91
Reviewed-on: https://go-review.googlesource.com/34170
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
Michael Hudson-Doyle 2016-12-09 08:49:23 +13:00
parent 291254414b
commit 67b2927990
2 changed files with 6 additions and 2 deletions

View File

@ -7,6 +7,11 @@ import (
"runtime"
)
// Having a function declared in the main package triggered
// golang.org/issue/18250
func DeclaredInMain() {
}
func main() {
defer depBase.ImplementedInAsm()
// This code below causes various go.itab.* symbols to be generated in

View File

@ -602,8 +602,7 @@ func (ctxt *Link) symtab() {
adduint(ctxt, moduledata, uint64(nitablinks))
adduint(ctxt, moduledata, uint64(nitablinks))
// The ptab slice
if ptab := ctxt.Syms.ROLookup("go.plugin.tabs", 0); ptab != nil {
ptab.Attr |= AttrReachable
if ptab := ctxt.Syms.ROLookup("go.plugin.tabs", 0); ptab != nil && ptab.Attr.Reachable() {
ptab.Attr |= AttrLocal
ptab.Type = obj.SRODATA