[libcxxabi] r212958 - Fix for libc++abi when using -Wl,--as-needed.
Dan Albert
danalbert at google.com
Mon Jul 14 10:00:30 PDT 2014
Author: danalbert
Date: Mon Jul 14 12:00:29 2014
New Revision: 212958
URL: http://llvm.org/viewvc/llvm-project?rev=212958&view=rev
Log:
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.
Modified:
libcxxabi/trunk/cmake/config-ix.cmake
libcxxabi/trunk/src/CMakeLists.txt
libcxxabi/trunk/src/Unwind/CMakeLists.txt
Modified: libcxxabi/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/cmake/config-ix.cmake?rev=212958&r1=212957&r2=212958&view=diff
==============================================================================
--- libcxxabi/trunk/cmake/config-ix.cmake (original)
+++ libcxxabi/trunk/cmake/config-ix.cmake Mon Jul 14 12:00:29 2014
@@ -36,3 +36,5 @@ check_cxx_compiler_flag(/GR-
# 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)
Modified: libcxxabi/trunk/src/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/CMakeLists.txt?rev=212958&r1=212957&r2=212958&view=diff
==============================================================================
--- libcxxabi/trunk/src/CMakeLists.txt (original)
+++ libcxxabi/trunk/src/CMakeLists.txt Mon Jul 14 12:00:29 2014
@@ -47,6 +47,13 @@ include_directories("${LIBCXXABI_LIBCXX_
# 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})
Modified: libcxxabi/trunk/src/Unwind/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/Unwind/CMakeLists.txt?rev=212958&r1=212957&r2=212958&view=diff
==============================================================================
--- libcxxabi/trunk/src/Unwind/CMakeLists.txt (original)
+++ libcxxabi/trunk/src/Unwind/CMakeLists.txt Mon Jul 14 12:00:29 2014
@@ -59,6 +59,7 @@ include_directories("${LIBCXXABI_LIBCXX_
# 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})
More information about the cfe-commits
mailing list