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

Charles Davis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 4 14:06:32 PDT 2018


cdavis5x created this revision.
cdavis5x added a reviewer: beanz.
Herald added subscribers: cfe-commits, chrib, christof, mgorny, dberris.

If `-nodefaultlibs` is given, we weren't actually linking to it. This
was true irrespective of passing `-rtlib=compiler-rt` (see previous
patch). Now we explicitly link it to handle that case.

I wonder if we should be linking these libraries only if we're using
`-nodefaultlibs`...


Repository:
  rUNW libunwind

https://reviews.llvm.org/D51657

Files:
  src/CMakeLists.txt


Index: src/CMakeLists.txt
===================================================================
--- src/CMakeLists.txt
+++ 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)
+  list(APPEND libraries gcc)
+endif()
 append_if(libraries LIBUNWIND_HAS_DL_LIB dl)
 if (LIBUNWIND_ENABLE_THREADS)
   append_if(libraries LIBUNWIND_HAS_PTHREAD_LIB pthread)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51657.163910.patch
Type: text/x-patch
Size: 623 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180904/dfb26826/attachment.bin>


More information about the cfe-commits mailing list