// linux/ppc64le and linux/arm64 (only for 48-bit VMA).
// -msan
// enable interoperation with memory sanitizer.
-// Supported only on linux/amd64, linux/arm64
+// Supported only on linux/amd64, linux/arm64, freebsd/amd64
// and only with Clang/LLVM as the host C compiler.
-// On linux/arm64, pie build mode will be used.
+// PIE build mode will be used on all platforms except linux/amd64.
// -asan
// enable interoperation with address sanitizer.
// Supported only on linux/arm64, linux/amd64.
linux/ppc64le and linux/arm64 (only for 48-bit VMA).
-msan
enable interoperation with memory sanitizer.
- Supported only on linux/amd64, linux/arm64
+ Supported only on linux/amd64, linux/arm64, freebsd/amd64
and only with Clang/LLVM as the host C compiler.
- On linux/arm64, pie build mode will be used.
+ PIE build mode will be used on all platforms except linux/amd64.
-asan
enable interoperation with address sanitizer.
Supported only on linux/arm64, linux/amd64.
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" {
+ // MSAN needs PIE on all platforms except linux/amd64.
+ // https://github.com/llvm/llvm-project/blob/llvmorg-13.0.1/clang/lib/Driver/SanitizerArgs.cpp#L621
+ if cfg.BuildBuildmode == "default" && (cfg.Goos != "linux" || cfg.Goarch != "amd64") {
cfg.BuildBuildmode = "pie"
}
}
switch goos {
case "linux":
return goarch == "amd64" || goarch == "arm64"
+ case "freebsd":
+ return goarch == "amd64"
default:
return false
}