diff options
| author | Cherry Mui <cherryyz@google.com> | 2025-12-15 15:36:23 -0500 |
|---|---|---|
| committer | David Chase <drchase@google.com> | 2025-12-15 13:08:29 -0800 |
| commit | d14b6427cf8db9607e25f19b7cd1bab615b557b9 (patch) | |
| tree | 18ad06bc1ffd2bad715167a60952f82dffb43299 /src/cmd/link/internal/ld/lib.go | |
| parent | 9ba0948172cbb05308fb2a9db823a720f8ffb9ad (diff) | |
| download | go-d14b6427cf8db9607e25f19b7cd1bab615b557b9.tar.xz | |
cmd/link: set canUsePlugins only on platforms that support plugin
If a program imports the plugin package, but the plugin build mode
is not supported on the platform, it still cannot use plugin. Don't
treat it like so.
Updates #76815.
Change-Id: I0fd719427d7c3cc96a94ce1f92d6e4457da92a90
Reviewed-on: https://go-review.googlesource.com/c/go/+/730164
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/link/internal/ld/lib.go')
| -rw-r--r-- | src/cmd/link/internal/ld/lib.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go index 22ee13dff8..bcad5add4a 100644 --- a/src/cmd/link/internal/ld/lib.go +++ b/src/cmd/link/internal/ld/lib.go @@ -38,6 +38,7 @@ import ( "encoding/binary" "fmt" "internal/buildcfg" + "internal/platform" "io" "log" "os" @@ -576,7 +577,8 @@ func (ctxt *Link) loadlib() { // Plugins a require cgo support to function. Similarly, plugins may require additional // internal linker support on some platforms which may not be implemented. - ctxt.canUsePlugins = ctxt.LibraryByPkg["plugin"] != nil && iscgo + ctxt.canUsePlugins = ctxt.LibraryByPkg["plugin"] != nil && iscgo && + platform.BuildModeSupported("gc", "plugin", buildcfg.GOOS, buildcfg.GOARCH) // We now have enough information to determine the link mode. determineLinkMode(ctxt) |
