[libcxxabi] r313304 - [libc++abi] Fix ASAN build with older compiler-rt versions.

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 14 15:19:29 PDT 2017


Author: ericwf
Date: Thu Sep 14 15:19:28 2017
New Revision: 313304

URL: http://llvm.org/viewvc/llvm-project?rev=313304&view=rev
Log:
[libc++abi] Fix ASAN build with older compiler-rt versions.

Summary:
compiler-rt recently added the `__asan_handle_no_return()` function that libc++abi needs to use, however older versions of compiler-rt don't provide this interface and that breaks the libc++abi build.

This patch attempts to fix the issues by using a macro to detect if `asan_interface.h` is new enough to provide the function.

See D37871

Reviewers: phosek, vitalybuka

Reviewed By: phosek, vitalybuka

Subscribers: dberris, cfe-commits

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

Modified:
    libcxxabi/trunk/src/cxa_exception.cpp

Modified: libcxxabi/trunk/src/cxa_exception.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_exception.cpp?rev=313304&r1=313303&r2=313304&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_exception.cpp (original)
+++ libcxxabi/trunk/src/cxa_exception.cpp Thu Sep 14 15:19:28 2017
@@ -222,7 +222,8 @@ __cxa_throw(void *thrown_object, std::ty
 
     exception_header->unwindHeader.exception_cleanup = exception_cleanup_func;
 
-#if __has_feature(address_sanitizer)
+#if __has_feature(address_sanitizer) && \
+  defined(SANITIZER_ASAN_INTERFACE_HAS_HANDLE_NO_RETURN)
     // Inform the ASan runtime that now might be a good time to clean stuff up.
     __asan_handle_no_return();
 #endif




More information about the cfe-commits mailing list