return false
}
+// supportedBuildMode reports whether the given build mode is supported.
func (t *tester) supportedBuildmode(mode string) bool {
pair := goos + "-" + goarch
switch mode {
if !t.extLink() {
return false
}
- switch pair {
- case "aix-ppc64",
- "darwin-amd64", "darwin-arm64", "ios-arm64",
- "linux-amd64", "linux-386", "linux-ppc64le", "linux-riscv64", "linux-s390x",
- "freebsd-amd64",
- "windows-amd64", "windows-386":
+ switch goos {
+ case "aix", "darwin", "ios", "windows":
return true
+ case "linux":
+ switch goarch {
+ case "386", "amd64", "arm", "armbe", "arm64", "arm64be", "ppc64", "ppc64le", "riscv64", "s390x":
+ return true
+ default:
+ // Other targets do not support -shared,
+ // per ParseFlags in
+ // cmd/compile/internal/base/flag.go.
+ // For c-archive the Go tool passes -shared,
+ // so that the result is suitable for inclusion
+ // in a PIE or shared library.
+ return false
+ }
+ case "freebsd":
+ return goarch == "amd64"
}
return false
case "c-shared":
BuildModePlugin
)
+// Set implements flag.Value to set the build mode based on the argument
+// to the -buildmode flag.
func (mode *BuildMode) Set(s string) error {
badmode := func() error {
return fmt.Errorf("buildmode %s not supported on %s/%s", s, buildcfg.GOOS, buildcfg.GOARCH)
return true
case "c-archive":
- // TODO(bcmills): This seems dubious.
- // Do we really support c-archive mode on js/wasm‽
- return platform != "linux/ppc64"
+ switch goos {
+ case "aix", "darwin", "ios", "windows":
+ return true
+ case "linux":
+ switch goarch {
+ case "386", "amd64", "arm", "armbe", "arm64", "arm64be", "ppc64le", "riscv64", "s390x":
+ // linux/ppc64 not supported because it does
+ // not support external linking mode yet.
+ return true
+ default:
+ // Other targets do not support -shared,
+ // per ParseFlags in
+ // cmd/compile/internal/base/flag.go.
+ // For c-archive the Go tool passes -shared,
+ // so that the result is suitable for inclusion
+ // in a PIE or shared library.
+ return false
+ }
+ case "freebsd":
+ return goarch == "amd64"
+ }
+ return false
case "c-shared":
switch platform {