[gn build] Allow use_ubsan=true on mac and unbreak use_asan, use_tsan, use_ubsan

`use_ubsan=true` seems to Just Work on macOS, so allow it.

https://reviews.llvm.org/D122862 broke use_asan=true, use_tsan=true, and
use_ubsan=true builds on Linux too. This makes this go again by explicitly
disabling asan, tsan, and ubsan for the baremetal part of the build. See
discussion on https://reviews.llvm.org/D122862 for other possible approaches.

Differential Revision: https://reviews.llvm.org/D127906
This commit is contained in:
Nico Weber 2022-06-15 17:45:10 -04:00
parent 0083a02839
commit 52554f7315
2 changed files with 10 additions and 3 deletions

View File

@ -334,8 +334,9 @@ config("compiler_defaults") {
"goma needs a sysroot: run `llvm/utils/sysroot.py make-fake --out-dir=sysroot` and add `sysroot = \"//sysroot\"` to your args.gn")
if (use_ubsan) {
assert(is_clang && current_os == "linux",
"ubsan only supported on Linux/Clang")
assert(is_clang && (current_os == "ios" || current_os == "linux" ||
current_os == "mac"),
"ubsan only supported on iOS/Clang, Linux/Clang, or macOS/Clang")
cflags += [
"-fsanitize=undefined",
"-fno-sanitize-recover=all",
@ -346,7 +347,7 @@ config("compiler_defaults") {
if (use_asan) {
assert(is_clang && (current_os == "ios" || current_os == "linux" ||
current_os == "mac"),
"asan only supported on iOS/Clang, Linux/Clang, and macOS/Clang")
"asan only supported on iOS/Clang, Linux/Clang, or macOS/Clang")
cflags += [ "-fsanitize=address" ]
ldflags += [ "-fsanitize=address" ]
}

View File

@ -253,6 +253,12 @@ stage2_unix_toolchain("stage2_baremetal_aarch64") {
toolchain_args = {
current_os = "baremetal"
current_cpu = "arm64"
# FIXME: These should be set in all toolchains building sanitizers,
# see discussion at https://reviews.llvm.org/D127906#3587329
use_asan = false
use_tsan = false
use_ubsan = false
}
}