blob: 4b9b47d7b5c04a9a647734a3e738d2b85ee9e06d [file] [log] [blame]
Link libcxx with gcc_eh when linking with gcc_s is
not desired. Normally, llvm's libunwind would be used but
we are not using libunwind in ChromeOS right now because of
some reported crashes when libunwind was used.
https://crbug.com/747113
diff --git a/libcxx/cmake/config-ix.cmake b/libcxx/cmake/config-ix.cmake
index 23ae71025e5..6820970c616 100644
--- a/libcxx/cmake/config-ix.cmake
+++ b/libcxx/cmake/config-ix.cmake
@@ -27,7 +27,7 @@ endif()
# configuration checks to avoid spurious link errors.
check_c_compiler_flag(-nodefaultlibs LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
if (LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
- set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nodefaultlibs")
+ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nostdlib++")
if (LIBCXX_HAS_C_LIB)
list(APPEND CMAKE_REQUIRED_LIBRARIES c)
endif ()
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index 21d0c925fab..f6f2e399d8a 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -727,7 +727,7 @@ endif()
# Link system libraries =======================================================
function(cxx_link_system_libraries target)
- target_add_link_flags_if_supported(${target} PRIVATE "-nodefaultlibs")
+ target_add_link_flags_if_supported(${target} PRIVATE "-nostdlib++")
target_add_compile_flags_if_supported(${target} PRIVATE "/Zl")
target_add_link_flags_if_supported(${target} PRIVATE "/nodefaultlib")
@@ -752,10 +752,7 @@ function(cxx_link_system_libraries target)
endif()
if (LIBCXX_USE_COMPILER_RT)
- find_compiler_rt_library(builtins LIBCXX_BUILTINS_LIBRARY)
- if (LIBCXX_BUILTINS_LIBRARY)
- target_link_libraries(${target} PRIVATE "${LIBCXX_BUILTINS_LIBRARY}")
- endif()
+ add_link_flags("-rtlib=compiler-rt")
elseif (LIBCXX_HAS_GCC_S_LIB)
target_link_libraries(${target} PRIVATE gcc_s)
endif()
diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt
index 120505fe18d..0080a00ea56 100644
--- a/libcxx/src/CMakeLists.txt
+++ b/libcxx/src/CMakeLists.txt
@@ -179,6 +179,8 @@ if (LIBCXX_ENABLE_SHARED)
target_link_libraries(cxx_shared PUBLIC unwind_shared)
elseif (LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY AND (TARGET unwind_static OR HAVE_LIBUNWIND))
# libunwind is already included in libc++abi
+ elseif (NOT LIBCXX_HAS_GCC_S_LIB)
+ add_library_flags(gcc_eh)
else()
target_link_libraries(cxx_shared PUBLIC unwind)
endif()