1// Copyright 2016 The Fuchsia Authors
2// Copyright (c) 2008 Travis Geiselbrecht
3//
4// Use of this source code is governed by a MIT-style
5// license that can be found in the LICENSE file or at
6// https://opensource.org/licenses/MIT
7
8
9/* some cruft we have to define when using the linux toolchain */
10#include <unwind.h>
11
12void *__dso_handle;
13
14#if defined(__ARM_EABI_UNWINDER__) && __ARM_EABI_UNWINDER__
15
16/* Our toolchain has eabi functionality built in, but they're not really used.
17 * so we stub them out here. */
18_Unwind_Reason_Code __aeabi_unwind_cpp_pr0(_Unwind_State state, _Unwind_Control_Block *ucbp, _Unwind_Context *context);
19_Unwind_Reason_Code __aeabi_unwind_cpp_pr0(_Unwind_State state, _Unwind_Control_Block *ucbp, _Unwind_Context *context)
20{
21    return _URC_FAILURE;
22}
23
24_Unwind_Reason_Code __aeabi_unwind_cpp_pr1(_Unwind_State state, _Unwind_Control_Block *ucbp, _Unwind_Context *context);
25_Unwind_Reason_Code __aeabi_unwind_cpp_pr1(_Unwind_State state, _Unwind_Control_Block *ucbp, _Unwind_Context *context)
26{
27    return _URC_FAILURE;
28}
29
30_Unwind_Reason_Code __aeabi_unwind_cpp_pr2(_Unwind_State state, _Unwind_Control_Block *ucbp, _Unwind_Context *context);
31_Unwind_Reason_Code __aeabi_unwind_cpp_pr2(_Unwind_State state, _Unwind_Control_Block *ucbp, _Unwind_Context *context)
32{
33    return _URC_FAILURE;
34}
35
36#endif
37
38/* needed by some piece of EABI */
39void raise(void);
40void raise(void)
41{
42}
43
44extern int __cxa_atexit(void (*func)(void *), void *arg, void *d);
45
46int __aeabi_atexit(void *arg, void (*func)(void *), void *d);
47int __aeabi_atexit(void *arg, void (*func)(void *), void *d)
48{
49    return __cxa_atexit(func, arg, d);
50}
51
52
53
54