1 // Copyright 2018 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
7 // RaceDetectorSupported reports whether goos/goarch supports the race
8 // detector. There is a copy of this function in cmd/dist/test.go.
9 // Race detector only supports 48-bit VMA on arm64. But it will always
10 // return true for arm64, because we don't have VMA size information during
12 func RaceDetectorSupported(goos, goarch string) bool {
15 return goarch == "amd64" || goarch == "ppc64le" || goarch == "arm64" || goarch == "s390x"
17 return goarch == "amd64" || goarch == "arm64"
18 case "freebsd", "netbsd", "openbsd", "windows":
19 return goarch == "amd64"
25 // MSanSupported reports whether goos/goarch supports the memory
27 // There is a copy of this function in misc/cgo/testsanitizers/cc_test.go.
28 func MSanSupported(goos, goarch string) bool {
31 return goarch == "amd64" || goarch == "arm64"
33 return goarch == "amd64"
39 // ASanSupported reports whether goos/goarch supports the address
41 // There is a copy of this function in misc/cgo/testsanitizers/cc_test.go.
42 func ASanSupported(goos, goarch string) bool {
45 return goarch == "arm64" || goarch == "amd64" || goarch == "riscv64" || goarch == "ppc64le"
51 // FuzzSupported reports whether goos/goarch supports fuzzing
52 // ('go test -fuzz=.').
53 func FuzzSupported(goos, goarch string) bool {
55 case "darwin", "freebsd", "linux", "windows":
62 // FuzzInstrumented reports whether fuzzing on goos/goarch uses coverage
63 // instrumentation. (FuzzInstrumented implies FuzzSupported.)
64 func FuzzInstrumented(goos, goarch string) bool {
66 case "amd64", "arm64":
67 // TODO(#14565): support more architectures.
68 return FuzzSupported(goos, goarch)
74 // MustLinkExternal reports whether goos/goarch requires external linking.
75 func MustLinkExternal(goos, goarch string) bool {
78 if goarch != "arm64" {
82 if goarch == "arm64" {
89 // BuildModeSupported reports whether goos/goarch supports the given build mode
90 // using the given compiler.
91 func BuildModeSupported(compiler, buildmode, goos, goarch string) bool {
92 if compiler == "gccgo" {
96 platform := goos + "/" + goarch
104 case "aix", "darwin", "ios", "windows":
108 case "386", "amd64", "arm", "armbe", "arm64", "arm64be", "ppc64le", "riscv64", "s390x":
109 // linux/ppc64 not supported because it does
110 // not support external linking mode yet.
113 // Other targets do not support -shared,
115 // cmd/compile/internal/base/flag.go.
116 // For c-archive the Go tool passes -shared,
117 // so that the result is suitable for inclusion
118 // in a PIE or shared library.
122 return goarch == "amd64"
128 case "linux/amd64", "linux/arm", "linux/arm64", "linux/386", "linux/ppc64le", "linux/riscv64", "linux/s390x",
129 "android/amd64", "android/arm", "android/arm64", "android/386",
131 "darwin/amd64", "darwin/arm64",
132 "windows/amd64", "windows/386", "windows/arm64":
145 case "linux/386", "linux/amd64", "linux/arm", "linux/arm64", "linux/ppc64le", "linux/riscv64", "linux/s390x",
146 "android/amd64", "android/arm", "android/arm64", "android/386",
148 "darwin/amd64", "darwin/arm64",
149 "ios/amd64", "ios/arm64",
151 "windows/386", "windows/amd64", "windows/arm", "windows/arm64":
158 case "linux/386", "linux/amd64", "linux/arm", "linux/arm64", "linux/ppc64le", "linux/s390x":
165 case "linux/amd64", "linux/arm", "linux/arm64", "linux/386", "linux/s390x", "linux/ppc64le",
166 "android/amd64", "android/386",
167 "darwin/amd64", "darwin/arm64",
178 func InternalLinkPIESupported(goos, goarch string) bool {
179 switch goos + "/" + goarch {
180 case "darwin/amd64", "darwin/arm64",
181 "linux/amd64", "linux/arm64", "linux/ppc64le",
183 "windows-amd64", "windows-386", "windows-arm":