aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/cgo/internal/testplugin/plugin_test.go
diff options
context:
space:
mode:
authorCherry Mui <cherryyz@google.com>2024-06-17 14:44:42 -0400
committerCherry Mui <cherryyz@google.com>2024-06-22 00:00:33 +0000
commit44f18706661db8b865719d15a5cfa0515d1a4fca (patch)
tree8ec9f9355501fafe96ab51f91ecc941c129088af /src/cmd/cgo/internal/testplugin/plugin_test.go
parent0af2148fdcd047e5aa15776a54ccc29d9aa36f7f (diff)
downloadgo-44f18706661db8b865719d15a5cfa0515d1a4fca.tar.xz
cmd/link: handle dynamic import variables on Darwin in plugin mode
CL 501855 added support for cgo_dynamic_import variables on Darwin. But it didn't support the plugin build mode on amd64, where the assembler turns a direct load (R_PCREL) to a load via GOT (R_GOTPCREL). This CL adds the support. We just need to handle external linking mode, as this can only occur in plugin or shared build mode, which requires external linking. Fixes #67976. Updates #50891. Change-Id: I0f56265d50bfcb36047fa5538ad7a5ec77e7ef96 Reviewed-on: https://go-review.googlesource.com/c/go/+/592499 Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/cmd/cgo/internal/testplugin/plugin_test.go')
-rw-r--r--src/cmd/cgo/internal/testplugin/plugin_test.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/cmd/cgo/internal/testplugin/plugin_test.go b/src/cmd/cgo/internal/testplugin/plugin_test.go
index 4900ada182..85dfd31123 100644
--- a/src/cmd/cgo/internal/testplugin/plugin_test.go
+++ b/src/cmd/cgo/internal/testplugin/plugin_test.go
@@ -414,3 +414,11 @@ func TestTextSectionSplit(t *testing.T) {
t.Errorf("runtime.text.1 not found, text section not split?")
}
}
+
+func TestIssue67976(t *testing.T) {
+ // Issue 67976: build failure with loading a dynimport variable (the runtime/pprof
+ // package does this on darwin) in a plugin on darwin/amd64.
+ // The test program uses runtime/pprof in a plugin.
+ globalSkip(t)
+ goCmd(t, "build", "-buildmode=plugin", "-o", "issue67976.so", "./issue67976/plugin.go")
+}