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>
"encoding/binary"
"fmt"
"internal/buildcfg"
+ "internal/platform"
"io"
"log"
"os"
// 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)