// The default is the number of CPUs available.
// -race
// enable data race detection.
-// Supported only on linux/amd64, freebsd/amd64, darwin/amd64 and windows/amd64.
+// Supported only on linux/amd64, freebsd/amd64, darwin/amd64, windows/amd64,
+// linux/ppc64le and linux/arm64 (only for 48-bit VMA).
// -msan
// enable interoperation with memory sanitizer.
// Supported only on linux/amd64, linux/arm64
// and only with Clang/LLVM as the host C compiler.
+// On linux/arm64, pie build mode will be used.
// -v
// print the names of packages as they are compiled.
// -work
The default is the number of CPUs available.
-race
enable data race detection.
- Supported only on linux/amd64, freebsd/amd64, darwin/amd64 and windows/amd64.
+ Supported only on linux/amd64, freebsd/amd64, darwin/amd64, windows/amd64,
+ linux/ppc64le and linux/arm64 (only for 48-bit VMA).
-msan
enable interoperation with memory sanitizer.
Supported only on linux/amd64, linux/arm64
and only with Clang/LLVM as the host C compiler.
+ On linux/arm64, pie build mode will be used.
-v
print the names of packages as they are compiled.
-work
mode := "race"
if cfg.BuildMSan {
mode = "msan"
+ // MSAN does not support non-PIE binaries on ARM64.
+ // See issue #33712 for details.
+ if cfg.Goos == "linux" && cfg.Goarch == "arm64" && cfg.BuildBuildmode == "default" {
+ cfg.BuildBuildmode = "pie"
+ }
}
modeFlag := "-" + mode