summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Hosek <phosek@chromium.org>2017-04-07 20:24:22 +0000
committerPetr Hosek <phosek@chromium.org>2017-04-07 20:24:22 +0000
commit98ba30a7144b325c6aac192b4761435624e60f5f (patch)
tree309047c64e70407797496240f11cc4054154c860
parentdb7033d3aecef8f7e5c264a00492f5d02e9e51c7 (diff)
Revert "[CMake][libunwind] Use -nodefaultlibs for CMake checks"
This reverts commit r299796. git-svn-id: https://llvm.org/svn/llvm-project/libunwind/trunk@299798 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--cmake/config-ix.cmake25
1 files changed, 2 insertions, 23 deletions
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
index be12ed5..0b0bb5c 100644
--- a/cmake/config-ix.cmake
+++ b/cmake/config-ix.cmake
@@ -3,35 +3,13 @@ include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
include(CheckLibraryExists)
-check_library_exists(c fopen "" LIBUNWIND_HAS_C_LIB)
-
-# libunwind is built with -nodefaultlibs, so we want all our checks to also
-# use this option, otherwise we may end up with an inconsistency between
-# the flags we think we require during configuration (if the checks are
-# performed without -nodefaultlibs) and the flags that are actually
-# required during compilation (which has the -nodefaultlibs). libc is
-# required for the link to go through. We remove sanitizers from the
-# configuration checks to avoid spurious link errors.
-check_c_compiler_flag(-nodefaultlibs LIBUNWIND_HAS_NODEFAULTLIBS_FLAG)
-if (LIBUNWIND_HAS_NODEFAULTLIBS_FLAG)
- set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nodefaultlibs")
- if (LIBUNWIND_HAS_C_LIB)
- list(APPEND CMAKE_REQUIRED_LIBRARIES c)
- endif ()
- if (CMAKE_C_FLAGS MATCHES -fsanitize OR CMAKE_CXX_FLAGS MATCHES -fsanitize)
- set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-sanitize=all")
- endif ()
- if (CMAKE_C_FLAGS MATCHES -fsanitize-coverage OR CMAKE_CXX_FLAGS MATCHES -fsanitize-coverage)
- set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-sanitize-coverage=edge,trace-cmp,indirect-calls,8bit-counters")
- endif ()
-endif ()
-
# Check compiler flags
check_c_compiler_flag(-funwind-tables LIBUNWIND_HAS_FUNWIND_TABLES)
check_cxx_compiler_flag(-fPIC LIBUNWIND_HAS_FPIC_FLAG)
check_cxx_compiler_flag(-fno-exceptions LIBUNWIND_HAS_NO_EXCEPTIONS_FLAG)
check_cxx_compiler_flag(-fno-rtti LIBUNWIND_HAS_NO_RTTI_FLAG)
check_cxx_compiler_flag(-fstrict-aliasing LIBUNWIND_HAS_FSTRICT_ALIASING_FLAG)
+check_cxx_compiler_flag(-nodefaultlibs LIBUNWIND_HAS_NODEFAULTLIBS_FLAG)
check_cxx_compiler_flag(-nostdinc++ LIBUNWIND_HAS_NOSTDINCXX_FLAG)
check_cxx_compiler_flag(-Wall LIBUNWIND_HAS_WALL_FLAG)
check_cxx_compiler_flag(-W LIBUNWIND_HAS_W_FLAG)
@@ -66,6 +44,7 @@ if(LIBUNWIND_HAS_STD_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
+check_library_exists(c fopen "" LIBUNWIND_HAS_C_LIB)
check_library_exists(dl dladdr "" LIBUNWIND_HAS_DL_LIB)
check_library_exists(pthread pthread_once "" LIBUNWIND_HAS_PTHREAD_LIB)