[libcxx-commits] [libcxxabi] 6f6c8a2 - [libc++abi] Make sure we link in CrashReporterClient.a when it's present

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 2 09:27:12 PDT 2020


Author: Louis Dionne
Date: 2020-06-02T12:23:53-04:00
New Revision: 6f6c8a2d96f580c79e00c43d0ec368346c7bff49

URL: https://github.com/llvm/llvm-project/commit/6f6c8a2d96f580c79e00c43d0ec368346c7bff49
DIFF: https://github.com/llvm/llvm-project/commit/6f6c8a2d96f580c79e00c43d0ec368346c7bff49.diff

LOG: [libc++abi] Make sure we link in CrashReporterClient.a when it's present

When building the system libc++abi for Apple, we use CrashReporterClient
to provide better crash logs when calling abort(). This is exemplified by
the fact that we test for the presence of <CrashReporterClient.h> in
abort_message.cpp.

However, we must link against CrashReporterClient.a in order to get that
functionality, otherwise we get a linking error.

Added: 
    

Modified: 
    libcxxabi/src/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libcxxabi/src/CMakeLists.txt b/libcxxabi/src/CMakeLists.txt
index 7b837a4ddf24..d5251acdca38 100644
--- a/libcxxabi/src/CMakeLists.txt
+++ b/libcxxabi/src/CMakeLists.txt
@@ -135,6 +135,17 @@ if ( APPLE )
       add_link_flags("-Wl,-rpath,${LIBDIR}")
     endif()
   endif()
+
+  # Make sure we link in CrashReporterClient if we find it -- it's used by
+  # abort() on Apple platforms when building the system dylib.
+  find_library(CrashReporterClient NAMES libCrashReporterClient.a
+                                   PATHS "${CMAKE_OSX_SYSROOT}/usr/local/lib")
+  if (CrashReporterClient)
+    message(STATUS "Linking with CrashReporterClient at ${CrashReporterClient}")
+    add_library_flags("${CrashReporterClient}")
+  else()
+    message(STATUS "Could not find CrashReporterClient, not linking against it")
+  endif()
 endif()
 
 split_list(LIBCXXABI_COMPILE_FLAGS)


        


More information about the libcxx-commits mailing list