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":
17 return goarch == "amd64" || goarch == "arm64"
18 case "freebsd", "netbsd", "openbsd", "windows":
19 return goarch == "amd64"
20 default:
21 return false
22 }
23 }
24
25
26
27
28 func MSanSupported(goos, goarch string) bool {
29 switch goos {
30 case "linux":
31 return goarch == "amd64" || goarch == "arm64"
32 default:
33 return false
34 }
35 }
36
37
38
39
40 func ASanSupported(goos, goarch string) bool {
41 switch goos {
42 case "linux":
43 return goarch == "arm64" || goarch == "amd64"
44 default:
45 return false
46 }
47 }
48
49
50
51 func FuzzSupported(goos, goarch string) bool {
52 switch goos {
53 case "darwin", "freebsd", "linux", "windows":
54 return true
55 default:
56 return false
57 }
58 }
59
60
61
62 func FuzzInstrumented(goos, goarch string) bool {
63 switch goarch {
64 case "amd64", "arm64":
65
66 return FuzzSupported(goos, goarch)
67 default:
68 return false
69 }
70 }
71
72
73
74 func MustLinkExternal(goos, goarch string) bool {
75 switch goos {
76 case "android":
77 if goarch != "arm64" {
78 return true
79 }
80 case "ios":
81 if goarch == "arm64" {
82 return true
83 }
84 }
85 return false
86 }
87
88
89
90 func BuildModeSupported(compiler, buildmode, goos, goarch string) bool {
91 if compiler == "gccgo" {
92 return true
93 }
94
95 platform := goos + "/" + goarch
96
97 switch buildmode {
98 case "archive":
99 return true
100
101 case "c-archive":
102
103
104 return platform != "linux/ppc64"
105
106 case "c-shared":
107 switch platform {
108 case "linux/amd64", "linux/arm", "linux/arm64", "linux/386", "linux/ppc64le", "linux/riscv64", "linux/s390x",
109 "android/amd64", "android/arm", "android/arm64", "android/386",
110 "freebsd/amd64",
111 "darwin/amd64", "darwin/arm64",
112 "windows/amd64", "windows/386", "windows/arm64":
113 return true
114 }
115 return false
116
117 case "default":
118 return true
119
120 case "exe":
121 return true
122
123 case "pie":
124 switch platform {
125 case "linux/386", "linux/amd64", "linux/arm", "linux/arm64", "linux/ppc64le", "linux/riscv64", "linux/s390x",
126 "android/amd64", "android/arm", "android/arm64", "android/386",
127 "freebsd/amd64",
128 "darwin/amd64", "darwin/arm64",
129 "ios/amd64", "ios/arm64",
130 "aix/ppc64",
131 "windows/386", "windows/amd64", "windows/arm":
132 return true
133 }
134 return false
135
136 case "shared":
137 switch platform {
138 case "linux/386", "linux/amd64", "linux/arm", "linux/arm64", "linux/ppc64le", "linux/s390x":
139 return true
140 }
141 return false
142
143 case "plugin":
144 switch platform {
145 case "linux/amd64", "linux/arm", "linux/arm64", "linux/386", "linux/s390x", "linux/ppc64le",
146 "android/amd64", "android/arm", "android/arm64", "android/386",
147 "darwin/amd64", "darwin/arm64",
148 "freebsd/amd64":
149 return true
150 }
151 return false
152
153 default:
154 return false
155 }
156 }
157
158 func InternalLinkPIESupported(goos, goarch string) bool {
159 switch goos + "/" + goarch {
160 case "darwin/amd64", "darwin/arm64",
161 "linux/amd64", "linux/arm64", "linux/ppc64le",
162 "android/arm64",
163 "windows-amd64", "windows-386", "windows-arm":
164 return true
165 }
166 return false
167 }
168
View as plain text