diff --git a/llvm/utils/gn/build/BUILD.gn b/llvm/utils/gn/build/BUILD.gn --- a/llvm/utils/gn/build/BUILD.gn +++ b/llvm/utils/gn/build/BUILD.gn @@ -334,8 +334,9 @@ "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 @@ 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" ] } diff --git a/llvm/utils/gn/build/toolchain/BUILD.gn b/llvm/utils/gn/build/toolchain/BUILD.gn --- a/llvm/utils/gn/build/toolchain/BUILD.gn +++ b/llvm/utils/gn/build/toolchain/BUILD.gn @@ -253,6 +253,12 @@ 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 } }