]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.18] cmd/link: mark unexported methods for plugins
authorCherry Mui <cherryyz@google.com>
Wed, 16 Mar 2022 17:07:57 +0000 (13:07 -0400)
committerCherry Mui <cherryyz@google.com>
Mon, 4 Apr 2022 19:03:11 +0000 (19:03 +0000)
commit290883a55989c14f4fb4c0f7e2cf079fc0f31a3d
treea54d6da2d7a21df50365660484ede6cab86ce4d2
parent39a8c8cf2e83de7e81d03ff1b1423411ed616cab
[release-branch.go1.18] cmd/link: mark unexported methods for plugins

When plugin is used, we already mark all exported methods
reachable. However, when the plugin and the host program share
a common package, an unexported method could also be reachable
from both the plugin and the host via interfaces. We need to mark
them as well.

Fixes #51737.
Updates #51621.

Change-Id: I1a70d3f96b66b803f2d0ab14d00ed0df276ea500
Reviewed-on: https://go-review.googlesource.com/c/go/+/393365
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
(cherry picked from commit 91631bc7e0131367eb051b581cf34573399ac592)
Reviewed-on: https://go-review.googlesource.com/c/go/+/397483
misc/cgo/testplugin/plugin_test.go
misc/cgo/testplugin/testdata/method3/main.go [new file with mode: 0644]
misc/cgo/testplugin/testdata/method3/p/p.go [new file with mode: 0644]
misc/cgo/testplugin/testdata/method3/plugin.go [new file with mode: 0644]
src/cmd/link/internal/ld/deadcode.go