[PATCH] D152591: [gn] Add Mac support to check-asan target

Leonard Grey via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 9 15:38:14 PDT 2023


lgrey created this revision.
lgrey added a reviewer: aeubanks.
Herald added a subscriber: Enna1.
Herald added a project: All.
lgrey requested review of this revision.
Herald added a project: LLVM.

I semi don't know what I'm doing here, but this seems to do the trick


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152591

Files:
  llvm/utils/gn/secondary/BUILD.gn
  llvm/utils/gn/secondary/compiler-rt/target.gni
  llvm/utils/gn/secondary/compiler-rt/test/asan/BUILD.gn


Index: llvm/utils/gn/secondary/compiler-rt/test/asan/BUILD.gn
===================================================================
--- llvm/utils/gn/secondary/compiler-rt/test/asan/BUILD.gn
+++ llvm/utils/gn/secondary/compiler-rt/test/asan/BUILD.gn
@@ -17,12 +17,16 @@
     "ASAN_TEST_BITS=64",
     "ASAN_TEST_APPLE_PLATFORM=",
     "ASAN_TEST_MIN_DEPLOYMENT_TARGET_FLAG=",
-    "ASAN_TEST_DYNAMIC=0",
     "ASAN_TEST_TARGET_ARCH=$crt_current_target_arch",
     "COMPILER_RT_ARM_THUMB=",
     "COMPILER_RT_BINARY_DIR=" + rebase_path("$root_gen_dir/compiler-rt"),
     "LIT_SITE_CFG_IN_HEADER=## Autogenerated from $input, do not edit",
   ]
+  if (host_os == "mac") {
+    values += [ "ASAN_TEST_DYNAMIC=1" ]
+  } else {
+    values += [ "ASAN_TEST_DYNAMIC=0" ]
+  }
 }
 
 if (current_toolchain != host_toolchain) {
@@ -41,11 +45,17 @@
       "//llvm/utils/llvm-lit($host_toolchain)",
       "//llvm/utils/not($host_toolchain)",
     ]
+    if (host_os == "mac") {
+      deps += [
+        "//llvm/tools/llvm-nm($host_toolchain)",
+        "//llvm/tools/llvm-objdump($host_toolchain)",
+      ]
+    }
   }
 }
 
 supported_toolchains = []
-if (host_os == "linux") {
+if (host_os == "linux" || host_os == "mac") {
   supported_toolchains += [ "//llvm/utils/gn/build/toolchain:stage2_unix" ]
 } else if (host_os == "win") {
   supported_toolchains += [ "//llvm/utils/gn/build/toolchain:stage2_win_x64" ]
Index: llvm/utils/gn/secondary/compiler-rt/target.gni
===================================================================
--- llvm/utils/gn/secondary/compiler-rt/target.gni
+++ llvm/utils/gn/secondary/compiler-rt/target.gni
@@ -32,6 +32,7 @@
   }
 } else if (current_os == "ios" || current_os == "mac") {
   crt_current_out_dir = "$clang_resource_dir/lib/darwin"
+  crt_current_target_suffix = "-$crt_current_target_arch"
 } else if (current_os == "baremetal") {
   crt_current_out_dir = "$clang_resource_dir/lib/baremetal"
   crt_current_target_suffix = "-$crt_current_target_arch"
Index: llvm/utils/gn/secondary/BUILD.gn
===================================================================
--- llvm/utils/gn/secondary/BUILD.gn
+++ llvm/utils/gn/secondary/BUILD.gn
@@ -22,7 +22,7 @@
       "//libcxxabi",
     ]
   }
-  if (current_os == "linux" || current_os == "win") {
+  if (current_os == "linux" || current_os == "win" || current_os=="mac") {
     deps += [ "//compiler-rt/test/asan" ]
   }
   if (current_os == "linux" || current_os == "android") {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152591.530103.patch
Type: text/x-patch
Size: 2458 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230609/c5c09cfe/attachment.bin>


More information about the llvm-commits mailing list