summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2019-09-25 21:46:24 +0000
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2019-09-25 21:46:24 +0000
commit6023cf223446e3f7038d4b867635f47b2d26e194 (patch)
tree18119e373e0865acbdbb463631658046088aa221
parent5e9cdeed778f0a62792b6dcfb6c3e990f67b315a (diff)
downloadbcm5719-llvm-6023cf223446e3f7038d4b867635f47b2d26e194.tar.gz
bcm5719-llvm-6023cf223446e3f7038d4b867635f47b2d26e194.zip
[libcxxabi] Fix arm build failer with libgcc
Both arm32 armv7/armv8 bots which do not use compiler-rt are failing to a linking issue: [100%] Built target cxxabi_static CMakeFiles/cxxabi_shared.dir/cxa_demangle.cpp.o: In function `(anonymous namespace)::itanium_demangle::OutputStream::writeUnsigned(unsigned long long, bool)': /home/buildslave/buildslave/libcxx-libcxxabi-libunwind-armv7-linux-noexceptions/llvm/projects/libcxxabi/src/demangle/Utility.h:55: undefined reference to `__aeabi_uldivmod' /home/buildslave/buildslave/libcxx-libcxxabi-libunwind-armv7-linux-noexceptions/llvm/projects/libcxxabi/src/demangle/Utility.h:56: undefined reference to `__aeabi_uldivmod' clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation) It seems after r371273 OutputStream is used more extensively and is pulling OutputStream::writeUnsigned (which thus requires unsigned integer module). The straightfoward fix is to explicit link against libgcc if compiler-rt is not used. llvm-svn: 372921
-rw-r--r--libcxxabi/cmake/config-ix.cmake10
-rw-r--r--libcxxabi/src/CMakeLists.txt4
2 files changed, 12 insertions, 2 deletions
diff --git a/libcxxabi/cmake/config-ix.cmake b/libcxxabi/cmake/config-ix.cmake
index 9195dfc74e1..94f89bedd97 100644
--- a/libcxxabi/cmake/config-ix.cmake
+++ b/libcxxabi/cmake/config-ix.cmake
@@ -7,6 +7,7 @@ include(CheckCSourceCompiles)
check_library_exists(c fopen "" LIBCXXABI_HAS_C_LIB)
if (NOT LIBCXXABI_USE_COMPILER_RT)
check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXXABI_HAS_GCC_S_LIB)
+ check_library_exists(gcc __aeabi_uldivmod "" LIBCXXABI_HAS_GCC_LIB)
endif ()
# libc++abi is built with -nodefaultlibs, so we want all our checks to also
@@ -26,8 +27,13 @@ if (LIBCXXABI_HAS_NODEFAULTLIBS_FLAG)
list(APPEND CMAKE_REQUIRED_FLAGS -rtlib=compiler-rt)
find_compiler_rt_library(builtins LIBCXXABI_BUILTINS_LIBRARY)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${LIBCXXABI_BUILTINS_LIBRARY}")
- elseif (LIBCXXABI_HAS_GCC_S_LIB)
- list(APPEND CMAKE_REQUIRED_LIBRARIES gcc_s)
+ else ()
+ if (LIBCXXABI_HAS_GCC_S_LIB)
+ list(APPEND CMAKE_REQUIRED_LIBRARIES gcc_s)
+ endif ()
+ if (LIBCXXABI_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
diff --git a/libcxxabi/src/CMakeLists.txt b/libcxxabi/src/CMakeLists.txt
index 6b8f76b1a39..6cfcb9cb3df 100644
--- a/libcxxabi/src/CMakeLists.txt
+++ b/libcxxabi/src/CMakeLists.txt
@@ -91,6 +91,10 @@ if (MINGW)
list(APPEND LIBCXXABI_LIBRARIES ${MINGW_LIBRARIES})
endif()
+if (NOT LIBCXXABI_USE_COMPILER_RT)
+ add_library_flags_if(LIBCXXABI_HAS_GCC_LIB gcc)
+endif ()
+
# Setup flags.
add_link_flags_if_supported(-nodefaultlibs)
OpenPOWER on IntegriCloud