1
2
3
4
5 package sys
6
7
8
9
10
11
12 func RaceDetectorSupported(goos, goarch string) bool {
13 switch goos {
14 case "linux":
15 return goarch == "amd64" || goarch == "ppc64le" || goarch == "arm64"
16 case "darwin", "freebsd", "netbsd", "windows":
17 return goarch == "amd64"
18 default:
19 return false
20 }
21 }
22
23
24
25 func MSanSupported(goos, goarch string) bool {
26 switch goos {
27 case "linux":
28 return goarch == "amd64" || goarch == "arm64"
29 default:
30 return false
31 }
32 }
33
34
35 func MustLinkExternal(goos, goarch string) bool {
36 switch goos {
37 case "android":
38 if goarch != "arm64" {
39 return true
40 }
41 case "darwin":
42 if goarch == "arm64" {
43 return true
44 }
45 }
46 return false
47 }
48
49
50
51 func BuildModeSupported(compiler, buildmode, goos, goarch string) bool {
52 if compiler == "gccgo" {
53 return true
54 }
55
56 platform := goos + "/" + goarch
57
58 switch buildmode {
59 case "archive":
60 return true
61
62 case "c-archive":
63
64
65 return platform != "linux/ppc64"
66
67 case "c-shared":
68 switch platform {
69 case "linux/amd64", "linux/arm", "linux/arm64", "linux/386", "linux/ppc64le", "linux/s390x",
70 "android/amd64", "android/arm", "android/arm64", "android/386",
71 "freebsd/amd64",
72 "darwin/amd64",
73 "windows/amd64", "windows/386":
74 return true
75 }
76 return false
77
78 case "default":
79 return true
80
81 case "exe":
82 return true
83
84 case "pie":
85 switch platform {
86 case "linux/386", "linux/amd64", "linux/arm", "linux/arm64", "linux/ppc64le", "linux/s390x",
87 "android/amd64", "android/arm", "android/arm64", "android/386",
88 "freebsd/amd64",
89 "darwin/amd64",
90 "aix/ppc64",
91 "windows/386", "windows/amd64", "windows/arm":
92 return true
93 }
94 return false
95
96 case "shared":
97 switch platform {
98 case "linux/386", "linux/amd64", "linux/arm", "linux/arm64", "linux/ppc64le", "linux/s390x":
99 return true
100 }
101 return false
102
103 case "plugin":
104 switch platform {
105 case "linux/amd64", "linux/arm", "linux/arm64", "linux/386", "linux/s390x", "linux/ppc64le",
106 "android/amd64", "android/arm", "android/arm64", "android/386",
107 "darwin/amd64",
108 "freebsd/amd64":
109 return true
110 }
111 return false
112
113 default:
114 return false
115 }
116 }
117
View as plain text