From 44f18706661db8b865719d15a5cfa0515d1a4fca Mon Sep 17 00:00:00 2001 From: Cherry Mui Date: Mon, 17 Jun 2024 14:44:42 -0400 Subject: 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 LUCI-TryBot-Result: Go LUCI --- .../internal/testplugin/testdata/issue67976/plugin.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/cmd/cgo/internal/testplugin/testdata/issue67976/plugin.go (limited to 'src/cmd/cgo/internal/testplugin/testdata/issue67976/plugin.go') diff --git a/src/cmd/cgo/internal/testplugin/testdata/issue67976/plugin.go b/src/cmd/cgo/internal/testplugin/testdata/issue67976/plugin.go new file mode 100644 index 0000000000..502ecc5c47 --- /dev/null +++ b/src/cmd/cgo/internal/testplugin/testdata/issue67976/plugin.go @@ -0,0 +1,16 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +import ( + "io" + "runtime/pprof" +) + +func main() {} + +func Start() { + pprof.StartCPUProfile(io.Discard) +} -- cgit v1.3