]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: do not mark go.plugin.tabs as reachable in non-plugins
authorMichael Hudson-Doyle <michael.hudson@canonical.com>
Thu, 8 Dec 2016 19:49:23 +0000 (08:49 +1300)
committerMichael Hudson-Doyle <michael.hudson@canonical.com>
Thu, 8 Dec 2016 20:01:23 +0000 (20:01 +0000)
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>
misc/cgo/testshared/src/exe/exe.go
src/cmd/link/internal/ld/symtab.go

index 31fbedd31c55826162940883cb457ec4f05e4ab7..f01ad8ab781e9b1815b91951ee8999d35ec41884 100644 (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
index 98ce3ad79b8f4f9467e0cc4dd7e32fd0a96062bc..dd0e5407e828c46b5aaa8ca8e46ce4350fa70155 100644 (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