[libunwind] r343990 - [CMake] Link to compiler-rt if LIBUNWIND_USE_COMPILER_RT is ON.
Charles Davis via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 8 11:35:00 PDT 2018
Author: cdavis
Date: Mon Oct 8 11:35:00 2018
New Revision: 343990
URL: http://llvm.org/viewvc/llvm-project?rev=343990&view=rev
Log:
[CMake] Link to compiler-rt if LIBUNWIND_USE_COMPILER_RT is ON.
Summary:
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`...
Reviewers: beanz
Subscribers: dberris, mgorny, christof, chrib, cfe-commits
Differential Revision: https://reviews.llvm.org/D51657
Modified:
libunwind/trunk/cmake/config-ix.cmake
libunwind/trunk/src/CMakeLists.txt
Modified: libunwind/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/cmake/config-ix.cmake?rev=343990&r1=343989&r2=343990&view=diff
==============================================================================
--- libunwind/trunk/cmake/config-ix.cmake (original)
+++ libunwind/trunk/cmake/config-ix.cmake Mon Oct 8 11:35:00 2018
@@ -7,6 +7,7 @@ check_library_exists(c fopen "" LIBUNWIN
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_HAS_NODEFAULTLIBS_FLAG)
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
Modified: libunwind/trunk/src/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/CMakeLists.txt?rev=343990&r1=343989&r2=343990&view=diff
==============================================================================
--- libunwind/trunk/src/CMakeLists.txt (original)
+++ libunwind/trunk/src/CMakeLists.txt Mon Oct 8 11:35:00 2018
@@ -53,7 +53,12 @@ set(LIBUNWIND_SOURCES
# 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)
More information about the cfe-commits
mailing list