[PATCH] D127906: [gn build] Allow use_ubsan=true on mac and unbreak use_asan and use_ubsan

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 15 16:41:32 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG52554f731514: [gn build] Allow use_ubsan=true on mac and unbreak use_asan, use_tsan, use_ubsan (authored by thakis).
Herald added a subscriber: abidh.

Changed prior to commit:
  https://reviews.llvm.org/D127906?vs=437352&id=437398#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127906/new/

https://reviews.llvm.org/D127906

Files:
  llvm/utils/gn/build/BUILD.gn
  llvm/utils/gn/build/toolchain/BUILD.gn


Index: llvm/utils/gn/build/toolchain/BUILD.gn
===================================================================
--- llvm/utils/gn/build/toolchain/BUILD.gn
+++ 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
   }
 }
 
Index: llvm/utils/gn/build/BUILD.gn
===================================================================
--- llvm/utils/gn/build/BUILD.gn
+++ 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" ]
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127906.437398.patch
Type: text/x-patch
Size: 1656 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220615/1fc5bb11/attachment.bin>


More information about the llvm-commits mailing list