unwind-ehabi-helpers.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. //===-- arm-ehabi-helpers.h - Supplementary ARM EHABI declarations --------===//
  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. #ifndef UNWIND_EHABI_HELPERS_H
  9. #define UNWIND_EHABI_HELPERS_H
  10. #include <stdint.h>
  11. // NOTE: see reasoning for this inclusion below
  12. #include <unwind.h>
  13. #if !defined(__ARM_EABI_UNWINDER__)
  14. // NOTE: _URC_OK, _URC_FAILURE must be present as preprocessor tokens. This
  15. // allows for a substitution of a constant which can be cast into the
  16. // appropriate enumerated type. This header is expected to always be included
  17. // AFTER unwind.h (which is why it is forcefully included above). This ensures
  18. // that we do not overwrite the token for the enumeration. Subsequent uses of
  19. // the token would be clean to rewrite with constant values.
  20. //
  21. // The typedef redeclaration should be safe. Due to the protection granted to
  22. // us by the `__ARM_EABI_UNWINDER__` above, we are guaranteed that we are in a
  23. // header not vended by gcc. The HP unwinder (being an itanium unwinder) does
  24. // not support EHABI, and the GNU unwinder, derived from the HP unwinder, also
  25. // does not support EHABI as of the introduction of this header. As such, we
  26. // are fairly certain that we are in the LLVM case. Here, _Unwind_State is a
  27. // typedef, and so we can get away with a redeclaration.
  28. //
  29. // Guarded redefinitions of the needed unwind state prevent the redefinition of
  30. // those states.
  31. #define _URC_OK 0
  32. #define _URC_FAILURE 9
  33. typedef uint32_t _Unwind_State;
  34. #if !defined(_US_UNWIND_FRAME_STARTING)
  35. #define _US_UNWIND_FRAME_STARTING ((_Unwind_State)1)
  36. #endif
  37. #if !defined(_US_ACTION_MASK)
  38. #define _US_ACTION_MASK ((_Unwind_State)3)
  39. #endif
  40. #endif
  41. #endif