1 //===-- utilities_posix.cpp -------------------------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifdef __BIONIC__ 10 #include <stdlib.h> 11 extern "C" GWP_ASAN_WEAK void android_set_abort_message(const char *); 12 #else // __BIONIC__ 13 #include <stdio.h> 14 #endif 15 16 namespace gwp_asan { 17 void die(const char *Message) { 18 #ifdef __BIONIC__ 19 if (&android_set_abort_message != nullptr) 20 android_set_abort_message(Message); 21 abort(); 22 #else // __BIONIC__ 23 fprintf(stderr, "%s", Message); 24 __builtin_trap(); 25 #endif // __BIONIC__ 26 } 27 } // namespace gwp_asan 28