[libc++abi] Add builtins to dynamic library link
authorPatrick Oppenlander <patrick.oppenlander@gmail.com>
Wed, 17 Feb 2021 22:04:36 +0000 (17:04 -0500)
committerLouis Dionne <ldionne.2@gmail.com>
Wed, 17 Feb 2021 22:05:59 +0000 (17:05 -0500)
Otherwise libc++abi.so fails to link on arm with undefined references to
some __aeabi_ builtins.

Differential Revision: https://reviews.llvm.org/D96574

libcxxabi/src/CMakeLists.txt

index 9003f79bbed1f5482b39e7cca15a335f9c27382f..ff1e45705dca6c0f7b4faa2e8d752626451d2cd4 100644 (file)
@@ -75,6 +75,11 @@ else()
   add_library_flags_if(LIBCXXABI_HAS_C_LIB c)
 endif()
 
+if (LIBCXXABI_USE_COMPILER_RT)
+  find_compiler_rt_library(builtins LIBCXXABI_BUILTINS_LIBRARY)
+  list(APPEND LIBCXXABI_SHARED_LIBRARIES "${LIBCXXABI_BUILTINS_LIBRARY}")
+endif ()
+
 if (LIBCXXABI_USE_LLVM_UNWINDER)
   # Prefer using the in-tree version of libunwind, either shared or static. If
   # none are found fall back to using -lunwind.