summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2014-07-14 17:00:29 +0000
committerDan Albert <danalbert@google.com>2014-07-14 17:00:29 +0000
commitd3217471537d45569dab3f65b4fab6b0c6b3abdd (patch)
tree2d77544d49ba8ad438e3c830dc8eb89a3febe4f3
parenta88f27897a2f638e14398422669155effd3a2ee2 (diff)
downloadbcm5719-llvm-d3217471537d45569dab3f65b4fab6b0c6b3abdd.tar.gz
bcm5719-llvm-d3217471537d45569dab3f65b4fab6b0c6b3abdd.zip
Fix for libc++abi when using -Wl,--as-needed.
The cmake files for libc++abi and the unwinder weren't linking against libpthread or an unwind library. If the tests were linked with -Wl,--as-needed, these libraries wouldn't be linked, causing them to fail. Patch contributed by İsmail Dönmez. llvm-svn: 212958
-rw-r--r--libcxxabi/cmake/config-ix.cmake2
-rw-r--r--libcxxabi/src/CMakeLists.txt7
-rw-r--r--libcxxabi/src/Unwind/CMakeLists.txt1
3 files changed, 10 insertions, 0 deletions
diff --git a/libcxxabi/cmake/config-ix.cmake b/libcxxabi/cmake/config-ix.cmake
index f9babd309ff..f56fe82b92a 100644
--- a/libcxxabi/cmake/config-ix.cmake
+++ b/libcxxabi/cmake/config-ix.cmake
@@ -36,3 +36,5 @@ check_cxx_compiler_flag(/GR- LIBCXXABI_HAS_NO_GR_FLAG)
# Check libraries
check_library_exists(c printf "" LIBCXXABI_HAS_C_LIB)
+check_library_exists(pthread pthread_once "" LIBCXXABI_HAS_PTHREAD_LIB)
+check_library_exists(gcc_eh _Unwind_GetRegionStart "" LIBCXXABI_HAS_GCC_EH_LIB)
diff --git a/libcxxabi/src/CMakeLists.txt b/libcxxabi/src/CMakeLists.txt
index 81b61efcba8..a3fdf6c443c 100644
--- a/libcxxabi/src/CMakeLists.txt
+++ b/libcxxabi/src/CMakeLists.txt
@@ -47,6 +47,13 @@ include_directories("${LIBCXXABI_LIBCXX_INCLUDES}")
# Generate library list.
set(libraries ${LIBCXXABI_CXX_ABI_LIBRARIES})
append_if(libraries LIBCXXABI_HAS_C_LIB c)
+append_if(libraries LIBCXXABI_HAS_PTHREAD_LIB pthread)
+
+if (LIBCXXABI_USE_LLVM_UNWINDER)
+ list(APPEND libraries unwind)
+else()
+ append_if(libraries LIBCXXABI_HAS_GCC_EH_LIB gcc_eh)
+endif()
target_link_libraries(cxxabi ${libraries})
diff --git a/libcxxabi/src/Unwind/CMakeLists.txt b/libcxxabi/src/Unwind/CMakeLists.txt
index 7e38e0f87ce..cc53ff54758 100644
--- a/libcxxabi/src/Unwind/CMakeLists.txt
+++ b/libcxxabi/src/Unwind/CMakeLists.txt
@@ -59,6 +59,7 @@ include_directories("${LIBCXXABI_LIBCXX_INCLUDES}")
# Generate library list.
set(libraries ${LIBCXXABI_CXX_ABI_LIBRARIES})
append_if(libraries LIBCXXABI_HAS_C_LIB c)
+append_if(libraries LIBCXXABI_HAS_PTHREAD_LIB pthread)
target_link_libraries(unwind ${libraries})
OpenPOWER on IntegriCloud