[PATCH] D51657: [CMake] Link to compiler-rt if LIBUNWIND_USE_COMPILER_RT is ON.

Phabricator via Phabricator reviews at reviews.llvm.org
Mon Oct 8 11:36:53 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL343990: [CMake] Link to compiler-rt if LIBUNWIND_USE_COMPILER_RT is ON. (authored by cdavis, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D51657

Files:
  libunwind/trunk/cmake/config-ix.cmake
  libunwind/trunk/src/CMakeLists.txt


Index: libunwind/trunk/src/CMakeLists.txt
===================================================================
--- libunwind/trunk/src/CMakeLists.txt
+++ libunwind/trunk/src/CMakeLists.txt
@@ -53,7 +53,12 @@
 # Generate library list.
 set(libraries)
 append_if(libraries LIBUNWIND_HAS_C_LIB c)
-append_if(libraries LIBUNWIND_HAS_GCC_S_LIB gcc_s)
+if (LIBUNWIND_USE_COMPILER_RT)
+  list(APPEND libraries "${LIBUNWIND_BUILTINS_LIBRARY}")
+else()
+  append_if(libraries LIBUNWIND_HAS_GCC_S_LIB gcc_s)
+  append_if(libraries LIBUNWIND_HAS_GCC_LIB gcc)
+endif()
 append_if(libraries LIBUNWIND_HAS_DL_LIB dl)
 if (LIBUNWIND_ENABLE_THREADS)
   append_if(libraries LIBUNWIND_HAS_PTHREAD_LIB pthread)
Index: libunwind/trunk/cmake/config-ix.cmake
===================================================================
--- libunwind/trunk/cmake/config-ix.cmake
+++ libunwind/trunk/cmake/config-ix.cmake
@@ -7,6 +7,7 @@
 
 if (NOT LIBUNWIND_USE_COMPILER_RT)
   check_library_exists(gcc_s __gcc_personality_v0 "" LIBUNWIND_HAS_GCC_S_LIB)
+  check_library_exists(gcc __absvdi2 "" LIBUNWIND_HAS_GCC_LIB)
 endif()
 
 # libunwind is built with -nodefaultlibs, so we want all our checks to also
@@ -25,8 +26,13 @@
   if (LIBUNWIND_USE_COMPILER_RT)
     find_compiler_rt_library(builtins LIBUNWIND_BUILTINS_LIBRARY)
     list(APPEND CMAKE_REQUIRED_LIBRARIES "${LIBUNWIND_BUILTINS_LIBRARY}")
-  elseif (LIBUNWIND_HAS_GCC_S_LIB)
-    list(APPEND CMAKE_REQUIRED_LIBRARIES gcc_s)
+  else ()
+    if (LIBUNWIND_HAS_GCC_S_LIB)
+      list(APPEND CMAKE_REQUIRED_LIBRARIES gcc_s)
+    endif ()
+    if (LIBUNWIND_HAS_GCC_LIB)
+      list(APPEND CMAKE_REQUIRED_LIBRARIES gcc)
+    endif ()
   endif ()
   if (MINGW)
     # Mingw64 requires quite a few "C" runtime libraries in order for basic


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51657.168689.patch
Type: text/x-patch
Size: 1761 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20181008/b887d961/attachment.bin>


More information about the libcxx-commits mailing list