diff --git a/0001-backport-cmd-link-mark-unexported-methods-for-plugins.patch b/0001-backport-cmd-link-mark-unexported-methods-for-plugins.patch new file mode 100644 index 0000000000000000000000000000000000000000..6b9dd4b07c525c5e2263c1abb1c7c8fa199f8c92 --- /dev/null +++ b/0001-backport-cmd-link-mark-unexported-methods-for-plugins.patch @@ -0,0 +1,39 @@ +From c872b0594f716a2a0799b07d7226a45f02c005f1 Mon Sep 17 00:00:00 2001 +From: Cherry Mui +Date: Wed, 16 Mar 2022 13:07:57 -0400 +Subject: [PATCH] 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 #51621. + +Change-Id: I1a70d3f96b66b803f2d0ab14d00ed0df276ea500 +Reviewed-on: https://go-review.googlesource.com/c/go/+/393365 +Trust: Cherry Mui +Run-TryBot: Cherry Mui +TryBot-Result: Gopher Robot +Reviewed-by: Than McIntosh +--- + src/cmd/link/internal/ld/deadcode.go | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/cmd/link/internal/ld/deadcode.go b/src/cmd/link/internal/ld/deadcode.go +index e4fa75f..21a9703 100644 +--- a/src/cmd/link/internal/ld/deadcode.go ++++ b/src/cmd/link/internal/ld/deadcode.go +@@ -350,7 +350,7 @@ func deadcode(ctxt *Link) { + // in the last pass. + rem := d.markableMethods[:0] + for _, m := range d.markableMethods { +- if (d.reflectSeen && m.isExported()) || d.ifaceMethod[m.m] { ++ if (d.reflectSeen && (m.isExported() || d.dynlink)) || d.ifaceMethod[m.m] { + d.markMethod(m) + } else { + rem = append(rem, m) +-- +1.8.3.1 + diff --git a/golang.spec b/golang.spec index 11cc5e2bfaf031a3fd58678fc80b622a265f1132..bd4be3e064a6befda2f94f9a6cb232bc45b7997e 100644 --- a/golang.spec +++ b/golang.spec @@ -66,12 +66,14 @@ Name: golang Version: 1.17.3 -Release: 1 +Release: 2 Summary: The Go Programming Language License: BSD and Public Domain URL: https://golang.org/ Source0: https://dl.google.com/go/go1.17.3.src.tar.gz +Patch0001:0001-backport-cmd-link-mark-unexported-methods-for-plugins.patch + %if !%{golang_bootstrap} BuildRequires: gcc-go >= 5 %else @@ -388,6 +390,9 @@ fi %files devel -f go-tests.list -f go-misc.list -f go-src.list %changelog +* Tue Jun 28 2022 hubin73 - 1.17.3-2 +- backport patch to fix bug of golang plugin mode + * Mon Nov 29 2021 chenjiankun - 1.17.3-1 - upgrade to 1.17.3