summaryrefslogtreecommitdiff
path: root/cmake/config-ix.cmake
diff options
context:
space:
mode:
authorPetr Hosek <phosek@chromium.org>2017-07-31 22:46:43 +0000
committerPetr Hosek <phosek@chromium.org>2017-07-31 22:46:43 +0000
commitadd8c7766a630d6a21adb1cb26304563f1c728a6 (patch)
treed82a3fdbf78d0c0454d910b06323d27de6d15fd2 /cmake/config-ix.cmake
parent42a455c34ed860066b92b8957fa9dd786026939d (diff)
[sanitizer] Fix the sanitizer build on Android
Android uses libgcc name even for shared library unlike other platforms which use libgcc_s. Furthemore, Android libstdc++ has a dependency on libdl. These need to be handled while performing CMake checks. Differential Revision: https://reviews.llvm.org/D36035 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309638 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake/config-ix.cmake')
-rw-r--r--cmake/config-ix.cmake12
1 files changed, 11 insertions, 1 deletions
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
index 64c1347c6..192c9b052 100644
--- a/cmake/config-ix.cmake
+++ b/cmake/config-ix.cmake
@@ -14,7 +14,11 @@ endfunction()
check_library_exists(c fopen "" COMPILER_RT_HAS_LIBC)
if (NOT SANITIZER_USE_COMPILER_RT)
- check_library_exists(gcc_s __gcc_personality_v0 "" COMPILER_RT_HAS_GCC_S_LIB)
+ if (ANDROID)
+ check_library_exists(gcc __gcc_personality_v0 "" COMPILER_RT_HAS_GCC_LIB)
+ else()
+ check_library_exists(gcc_s __gcc_personality_v0 "" COMPILER_RT_HAS_GCC_S_LIB)
+ endif()
endif()
check_c_compiler_flag(-nodefaultlibs COMPILER_RT_HAS_NODEFAULTLIBS_FLAG)
@@ -29,6 +33,8 @@ if (COMPILER_RT_HAS_NODEFAULTLIBS_FLAG)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${COMPILER_RT_BUILTINS_LIBRARY}")
elseif (COMPILER_RT_HAS_GCC_S_LIB)
list(APPEND CMAKE_REQUIRED_LIBRARIES gcc_s)
+ elseif (COMPILER_RT_HAS_GCC_LIB)
+ list(APPEND CMAKE_REQUIRED_LIBRARIES gcc)
endif ()
endif ()
@@ -98,6 +104,10 @@ check_library_exists(dl dlopen "" COMPILER_RT_HAS_LIBDL)
check_library_exists(rt shm_open "" COMPILER_RT_HAS_LIBRT)
check_library_exists(m pow "" COMPILER_RT_HAS_LIBM)
check_library_exists(pthread pthread_create "" COMPILER_RT_HAS_LIBPTHREAD)
+if (ANDROID AND COMPILER_RT_HAS_LIBDL)
+ # Android's libstdc++ has a dependency on libdl.
+ list(APPEND CMAKE_REQUIRED_LIBRARIES dl)
+endif()
check_library_exists(stdc++ __cxa_throw "" COMPILER_RT_HAS_LIBSTDCXX)
# Linker flags.