diff --git a/compiler-rt/lib/gwp_asan/definitions.h b/compiler-rt/lib/gwp_asan/definitions.h --- a/compiler-rt/lib/gwp_asan/definitions.h +++ b/compiler-rt/lib/gwp_asan/definitions.h @@ -15,4 +15,6 @@ #define GWP_ASAN_UNLIKELY(X) __builtin_expect(!!(X), 0) #define GWP_ASAN_ALWAYS_INLINE inline __attribute__((always_inline)) +#define GWP_ASAN_WEAK __attribute__((weak)) + #endif // GWP_ASAN_DEFINITIONS_H_ diff --git a/compiler-rt/lib/gwp_asan/platform_specific/utilities_posix.cpp b/compiler-rt/lib/gwp_asan/platform_specific/utilities_posix.cpp --- a/compiler-rt/lib/gwp_asan/platform_specific/utilities_posix.cpp +++ b/compiler-rt/lib/gwp_asan/platform_specific/utilities_posix.cpp @@ -6,11 +6,13 @@ // //===----------------------------------------------------------------------===// +#include "gwp_asan/definitions.h" #include "gwp_asan/utilities.h" #ifdef ANDROID #include #include +extern "C" GWP_ASAN_WEAK void android_set_abort_message(const char *); #else // ANDROID #include #endif @@ -19,7 +21,7 @@ #ifdef ANDROID void Check(bool Condition, const char *Message) { - if (Condition) + if (Condition || &android_set_abort_message == nullptr) return; android_set_abort_message(Message); abort();