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#include <features.h> // IWYU pragma: keep (for __BIONIC__ macro)
10
11#ifdef __BIONIC__
12#include "gwp_asan/definitions.h"
13#include <stdlib.h>
14extern "C" GWP_ASAN_WEAK void android_set_abort_message(const char *);
15#else // __BIONIC__
16#include <stdio.h>
17#endif
18
19namespace gwp_asan {
20void die(const char *Message) {
21#ifdef __BIONIC__
22 if (&android_set_abort_message != nullptr)
23 android_set_abort_message(Message);
24 abort();
25#else // __BIONIC__
26 fprintf(stderr, format: "%s", Message);
27 __builtin_trap();
28#endif // __BIONIC__
29}
30} // namespace gwp_asan
31

source code of compiler-rt/lib/gwp_asan/platform_specific/utilities_posix.cpp