[compiler-rt] 3bf3996 - [TSan] Add CMake check for minimal SDK requirements on Darwin

Julian Lettner via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 26 11:33:45 PST 2020


Author: Julian Lettner
Date: 2020-02-26T11:33:24-08:00
New Revision: 3bf3996cd4ef2d4898b32d4cef52d6549bbe6820

URL: https://github.com/llvm/llvm-project/commit/3bf3996cd4ef2d4898b32d4cef52d6549bbe6820
DIFF: https://github.com/llvm/llvm-project/commit/3bf3996cd4ef2d4898b32d4cef52d6549bbe6820.diff

LOG: [TSan] Add CMake check for minimal SDK requirements on Darwin

Fails with the following message in the error case:
```
CMake Error at /path/to/llvm-project/compiler-rt/lib/tsan/CMakeLists.txt:119 (message):
  Building the TSan runtime requires at least macOS SDK 10.12
```

Fixes #44682.
https://bugs.llvm.org/show_bug.cgi?id=44682

Reviewed By: dmajor, delcypher

Differential Revision: https://reviews.llvm.org/D74501

Added: 
    

Modified: 
    compiler-rt/lib/tsan/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/tsan/CMakeLists.txt b/compiler-rt/lib/tsan/CMakeLists.txt
index 9fd3e2d77924..c99b16d8aaa3 100644
--- a/compiler-rt/lib/tsan/CMakeLists.txt
+++ b/compiler-rt/lib/tsan/CMakeLists.txt
@@ -114,6 +114,14 @@ set(TSAN_RUNTIME_LIBRARIES)
 add_compiler_rt_component(tsan)
 
 if(APPLE)
+  # Ideally we would check the SDK version for the actual platform we are
+  # building for here.  To make our lifes easier we assume the host SDK setup is
+  # sane and use the macOS SDK version as a proxy for aligned SDKs.
+  find_darwin_sdk_version(macosx_sdk_version "macosx")
+  if ("${macosx_sdk_version}" VERSION_LESS 10.12)
+    message(FATAL_ERROR "Building the TSan runtime requires at least macOS SDK 10.12 (or aligned SDK on other platforms)")
+  endif()
+
   add_asm_sources(TSAN_ASM_SOURCES rtl/tsan_rtl_amd64.S rtl/tsan_rtl_aarch64.S)
 
   set(TSAN_LINK_LIBS ${SANITIZER_COMMON_LINK_LIBS})


        


More information about the llvm-commits mailing list