[CMake] Build shared version of runtimes for Fuchsia
authorPetr Hosek <phosek@chromium.org>
Wed, 9 May 2018 21:24:06 +0000 (21:24 +0000)
committerPetr Hosek <phosek@chromium.org>
Wed, 9 May 2018 21:24:06 +0000 (21:24 +0000)
Fuchsia is no longer treated as UNIX which means we need to explicitly
enable building of shared versions of runtimes.

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

llvm-svn: 331922

compiler-rt/CMakeLists.txt
compiler-rt/lib/asan/CMakeLists.txt
compiler-rt/lib/hwasan/CMakeLists.txt
compiler-rt/lib/msan/CMakeLists.txt
compiler-rt/lib/profile/CMakeLists.txt
compiler-rt/lib/ubsan/CMakeLists.txt
compiler-rt/lib/ubsan_minimal/CMakeLists.txt

index aaf6789d66a6746b567125e89547ace8a3a6539b..57045c206475e9ff77bc37dfa1c9ee549acde27d 100644 (file)
@@ -278,6 +278,12 @@ else()
   set(SANITIZER_LIMIT_FRAME_SIZE FALSE)
 endif()
 
+if(FUCHSIA OR UNIX)
+  set(SANITIZER_USE_SYMBOLS TRUE)
+else()
+  set(SANITIZER_USE_SYMBOLS FALSE)
+endif()
+
 # Build sanitizer runtimes with debug info.
 if(MSVC)
   # Use /Z7 instead of /Zi for the asan runtime. This avoids the LNK4099
index a95d3ce080aefe5c89fcee5d7fee86f1d7998063..bacdff9687b3e96927354f8694f0f4d1ffa585a6 100644 (file)
@@ -227,7 +227,7 @@ else()
       DEFS ${ASAN_DYNAMIC_DEFINITIONS}
       PARENT_TARGET asan)
 
-    if (UNIX AND NOT ${arch} STREQUAL "i386")
+    if (SANITIZER_USE_SYMBOLS AND NOT ${arch} STREQUAL "i386")
       add_sanitizer_rt_symbols(clang_rt.asan_cxx
         ARCHS ${arch})
       add_dependencies(asan clang_rt.asan_cxx-${arch}-symbols)
index a808d9e2333da31f9853911fb73ac545e8d0b659..d2e91ee371f6533331b802a29e0558af6577213a 100644 (file)
@@ -131,7 +131,7 @@ foreach(arch ${HWASAN_SUPPORTED_ARCH})
     DEFS ${ASAN_DYNAMIC_DEFINITIONS}
     PARENT_TARGET hwasan)
 
-  if(UNIX)
+  if(SANITIZER_USE_SYMBOLS)
     add_sanitizer_rt_symbols(clang_rt.hwasan
       ARCHS ${arch}
       EXTRA hwasan.syms.extra)
index fa8d8e1a0d697a84e2251d19d85ff185f3fdfbf4..30566c4a45d5cea446ef8e45d989fc69a3a0980d 100644 (file)
@@ -54,7 +54,7 @@ foreach(arch ${MSAN_SUPPORTED_ARCH})
     PARENT_TARGET msan)
   list(APPEND MSAN_RUNTIME_LIBRARIES clang_rt.msan-${arch}
                                      clang_rt.msan_cxx-${arch})
-  if(UNIX)
+  if(SANITIZER_USE_SYMBOLS)
     add_sanitizer_rt_symbols(clang_rt.msan
       ARCHS ${arch}
       EXTRA msan.syms.extra)
index 91d67ec365c5a7eb91c962ef59072e1264732352..9aab1252291efc15cf35c1f6ea2ff0b5a71ec8a6 100644 (file)
@@ -68,7 +68,7 @@ if(WIN32)
     list(APPEND PROFILE_SOURCES WindowsMMap.c)
 endif()
 
-if(UNIX)
+if(FUCHSIA OR UNIX)
  set(EXTRA_FLAGS
      -fPIC
      -Wno-pedantic)
index 183f3ff567ec68c983165c5717d36b026564c96e..20d6e2914252ad0836a5c4f0833fb5b0018eed68 100644 (file)
@@ -173,7 +173,7 @@ else()
       CFLAGS ${UBSAN_CXXFLAGS}
       PARENT_TARGET ubsan)
 
-    if (UNIX)
+    if (FUCHSIA OR UNIX)
       add_compiler_rt_runtime(clang_rt.ubsan_standalone
         SHARED
         ARCHS ${UBSAN_SUPPORTED_ARCH}
index 54860a3d27645a4f8a875f6e4fa11d22389f934d..b70246845f84907fc6c6c55cfae6a99c578b1b48 100644 (file)
@@ -44,7 +44,7 @@ if(COMPILER_RT_HAS_UBSAN_MINIMAL)
     LINK_LIBS ${UBSAN_DYNAMIC_LIBS}
     PARENT_TARGET ubsan-minimal)
 
-  if (UNIX AND NOT APPLE)
+  if (SANITIZER_USE_SYMBOLS AND NOT APPLE)
     set(ARCHS_FOR_SYMBOLS ${UBSAN_SUPPORTED_ARCH})
     list(REMOVE_ITEM ARCHS_FOR_SYMBOLS i386 i686)
     add_sanitizer_rt_symbols(clang_rt.ubsan_minimal