[GWP-ASan] Use weak abort message definition.
am: 89b7cb627b

Change-Id: I095f81dd3fd5d22e756b8112d83c29747dbfe828
diff --git a/gwp_asan/definitions.h b/gwp_asan/definitions.h
index 870dd96..563c408 100644
--- a/gwp_asan/definitions.h
+++ b/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/gwp_asan/platform_specific/utilities_posix.cpp b/gwp_asan/platform_specific/utilities_posix.cpp
index b292351..68d7ee7 100644
--- a/gwp_asan/platform_specific/utilities_posix.cpp
+++ b/gwp_asan/platform_specific/utilities_posix.cpp
@@ -6,11 +6,12 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "gwp_asan/definitions.h"
 #include "gwp_asan/utilities.h"
 
 #ifdef ANDROID
-#include <android/set_abort_message.h>
 #include <stdlib.h>
+extern "C" GWP_ASAN_WEAK void android_set_abort_message(const char *);
 #else // ANDROID
 #include <stdio.h>
 #endif
@@ -21,7 +22,8 @@
 void Check(bool Condition, const char *Message) {
   if (Condition)
     return;
-  android_set_abort_message(Message);
+  if (&android_set_abort_message != nullptr)
+    android_set_abort_message(Message);
   abort();
 }
 #else  // ANDROID