Skip to content

Commit

Permalink
cmd/link: do not mark go.plugin.tabs as reachable in non-plugins
Browse files Browse the repository at this point in the history
Fixes #18250

Change-Id: I4f61591356ddb4a906c206ad8456d1839daf7b91
Reviewed-on: https://go-review.googlesource.com/34170
Run-TryBot: Michael Hudson-Doyle <[email protected]>
Reviewed-by: David Crawshaw <[email protected]>
  • Loading branch information
mwhudson committed Dec 8, 2016
1 parent 2912544 commit 67b2927
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 5 additions & 0 deletions misc/cgo/testshared/src/exe/exe.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/cmd/link/internal/ld/symtab.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 67b2927

Please sign in to comment.