diff --git a/libunwind/cmake/config-ix.cmake b/libunwind/cmake/config-ix.cmake --- a/libunwind/cmake/config-ix.cmake +++ b/libunwind/cmake/config-ix.cmake @@ -22,63 +22,6 @@ endif () endif() -# libunwind is using -nostdlib++ at the link step when available, -# otherwise -nodefaultlibs is used. We want all our checks to also -# use one of these options, otherwise we may end up with an inconsistency between -# the flags we think we require during configuration (if the checks are -# performed without one of those options) and the flags that are actually -# required during compilation (which has the -nostdlib++ or -nodefaultlibs). libc is -# required for the link to go through. We remove sanitizers from the -# configuration checks to avoid spurious link errors. - -llvm_check_compiler_linker_flag(CXX "-nostdlib++" CXX_SUPPORTS_NOSTDLIBXX_FLAG) -if (CXX_SUPPORTS_NOSTDLIBXX_FLAG) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nostdlib++") -else() - llvm_check_compiler_linker_flag(C "-nodefaultlibs" C_SUPPORTS_NODEFAULTLIBS_FLAG) - if (C_SUPPORTS_NODEFAULTLIBS_FLAG) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nodefaultlibs") - endif() -endif() - -if (CXX_SUPPORTS_NOSTDLIBXX_FLAG OR C_SUPPORTS_NODEFAULTLIBS_FLAG) - if (LIBUNWIND_HAS_C_LIB) - list(APPEND CMAKE_REQUIRED_LIBRARIES c) - endif () - if (LIBUNWIND_USE_COMPILER_RT) - include(HandleCompilerRT) - find_compiler_rt_library(builtins LIBUNWIND_BUILTINS_LIBRARY - FLAGS ${LIBUNWIND_COMPILE_FLAGS}) - list(APPEND CMAKE_REQUIRED_LIBRARIES "${LIBUNWIND_BUILTINS_LIBRARY}") - 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 - # programs to link successfully with -nodefaultlibs. - if (LIBUNWIND_USE_COMPILER_RT) - set(MINGW_RUNTIME ${LIBUNWIND_BUILTINS_LIBRARY}) - else () - set(MINGW_RUNTIME gcc_s gcc) - endif() - set(MINGW_LIBRARIES mingw32 ${MINGW_RUNTIME} moldname mingwex msvcrt advapi32 - shell32 user32 kernel32 mingw32 ${MINGW_RUNTIME} - moldname mingwex msvcrt) - list(APPEND CMAKE_REQUIRED_LIBRARIES ${MINGW_LIBRARIES}) - 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} -fsanitize-coverage=0") - endif () -endif () - # Check compiler pragmas if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") cmake_push_check_state() diff --git a/libunwind/src/CMakeLists.txt b/libunwind/src/CMakeLists.txt --- a/libunwind/src/CMakeLists.txt +++ b/libunwind/src/CMakeLists.txt @@ -88,11 +88,6 @@ # Setup flags. add_link_flags_if(CXX_SUPPORTS_UNWINDLIB_EQ_NONE_FLAG --unwindlib=none) -if (CXX_SUPPORTS_NOSTDLIBXX_FLAG) - add_link_flags_if_supported(-nostdlib++) -else() - add_link_flags_if_supported(-nodefaultlibs) -endif() # MINGW_LIBRARIES is defined in config-ix.cmake add_library_flags_if(MINGW "${MINGW_LIBRARIES}")