blob: ccb0765975a9a40fc2b9d137ea0e3da448f93e4f [file] [log] [blame]
Saleem Abdulrasool865a6712016-11-18 18:21:06 +00001/* ===-- arm-ehabi-helpers.h - Supplementary ARM EHABI declarations --------===
2 *
3 * The LLVM Compiler Infrastructure
4 *
5 * This file is dual licensed under the MIT and the University of Illinois Open
6 * Source Licenses. See LICENSE.TXT for details.
7 *
8 * ===--------------------------------------------------------------------=== */
9
10#ifndef UNWIND_EHABI_HELPERS_H
11#define UNWIND_EHABI_HELPERS_H
12
13#include <stdint.h>
14/* NOTE: see reasoning for this inclusion below */
15#include <unwind.h>
16
17#if !defined(__ARM_EABI_UNWINDER__)
18
19/*
20 * NOTE: _URC_OK, _URC_FAILURE must be present as preprocessor tokens. This
21 * allows for a substitution of a constant which can be cast into the
22 * appropriate enumerated type. This header is expected to always be included
23 * AFTER unwind.h (which is why it is forcefully included above). This ensures
24 * that we do not overwrite the token for the enumeration. Subsequent uses of
25 * the token would be clean to rewrite with constant values.
26 *
27 * The typedef redeclaration should be safe. Due to the protection granted to
28 * us by the `__ARM_EABI_UNWINDER__` above, we are guaranteed that we are in a
29 * header not vended by gcc. The HP unwinder (being an itanium unwinder) does
30 * not support EHABI, and the GNU unwinder, derived from the HP unwinder, also
31 * does not support EHABI as of the introduction of this header. As such, we
32 * are fairly certain that we are in the LLVM case. Here, _Unwind_State is a
33 * typedef, and so we can get away with a redeclaration.
34 *
35 * Guarded redefinitions of the needed unwind state prevent the redefinition of
36 * those states.
37 */
38
39#define _URC_OK 0
40#define _URC_FAILURE 9
41
42typedef uint32_t _Unwind_State;
43
44#if !defined(_US_UNWIND_FRAME_STARTING)
45#define _US_UNWIND_FRAME_STARTING ((_Unwind_State)1)
46#endif
47
48#if !defined(_US_ACTION_MASK)
49#define _US_ACTION_MASK ((_Unwind_State)3)
50#endif
51
52#endif
53
54#endif
55