[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 14:47:22 PDT 2022


thakis created this revision.
thakis added reviewers: aeubanks, pcc.
Herald added a project: All.
thakis requested review of this revision.
Herald added a project: LLVM.

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

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


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,8 @@
   toolchain_args = {
     current_os = "baremetal"
     current_cpu = "arm64"
+    use_asan = 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",


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


More information about the llvm-commits mailing list