Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

119 lines
3.8KB

  1. /* Header file for the ARM EABI unwinder
  2. Copyright (C) 2003-2020 Free Software Foundation, Inc.
  3. Contributed by Paul Brook
  4. This file is free software; you can redistribute it and/or modify it
  5. under the terms of the GNU General Public License as published by the
  6. Free Software Foundation; either version 3, or (at your option) any
  7. later version.
  8. This file is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. General Public License for more details.
  12. Under Section 7 of GPL version 3, you are granted additional
  13. permissions described in the GCC Runtime Library Exception, version
  14. 3.1, as published by the Free Software Foundation.
  15. You should have received a copy of the GNU General Public License and
  16. a copy of the GCC Runtime Library Exception along with this program;
  17. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  18. <http://www.gnu.org/licenses/>. */
  19. /* Language-independent unwinder header public defines. This contains both
  20. ABI defined objects, and GNU support routines. */
  21. #ifndef UNWIND_ARM_H
  22. #define UNWIND_ARM_H
  23. #include "unwind-arm-common.h"
  24. #define UNWIND_STACK_REG 13
  25. /* Use IP as a scratch register within the personality routine. */
  26. #define UNWIND_POINTER_REG 12
  27. #define FDPIC_REGNUM 9
  28. #define STR(x) #x
  29. #define XSTR(x) STR(x)
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. _Unwind_Ptr __attribute__((weak)) __gnu_Unwind_Find_got (_Unwind_Ptr);
  34. static inline _Unwind_Ptr _Unwind_gnu_Find_got (_Unwind_Ptr ptr)
  35. {
  36. _Unwind_Ptr res;
  37. if (__gnu_Unwind_Find_got)
  38. res = __gnu_Unwind_Find_got (ptr);
  39. else
  40. __asm volatile ("mov %[result], r" XSTR(FDPIC_REGNUM)
  41. : [result] "=r" (res));
  42. return res;
  43. }
  44. /* Decode an R_ARM_TARGET2 relocation. */
  45. static inline _Unwind_Word
  46. _Unwind_decode_typeinfo_ptr (_Unwind_Word base __attribute__ ((unused)),
  47. _Unwind_Word ptr)
  48. {
  49. _Unwind_Word tmp;
  50. tmp = *(_Unwind_Word *) ptr;
  51. /* Zero values are always NULL. */
  52. if (!tmp)
  53. return 0;
  54. #if __FDPIC__
  55. /* For FDPIC, we store the offset of the GOT entry. */
  56. /* So, first get GOT from dynamic linker and then use indirect access. */
  57. tmp += _Unwind_gnu_Find_got (ptr);
  58. tmp = *(_Unwind_Word *) tmp;
  59. #elif (defined(linux) && !defined(__uClinux__)) || defined(__NetBSD__) \
  60. || defined(__FreeBSD__) || defined(__fuchsia__)
  61. /* Pc-relative indirect. */
  62. #define _GLIBCXX_OVERRIDE_TTYPE_ENCODING (DW_EH_PE_pcrel | DW_EH_PE_indirect)
  63. tmp += ptr;
  64. tmp = *(_Unwind_Word *) tmp;
  65. #elif defined(__symbian__) || defined(__uClinux__)
  66. #define _GLIBCXX_OVERRIDE_TTYPE_ENCODING (DW_EH_PE_absptr)
  67. /* Absolute pointer. Nothing more to do. */
  68. #else
  69. #define _GLIBCXX_OVERRIDE_TTYPE_ENCODING (DW_EH_PE_pcrel)
  70. /* Pc-relative pointer. */
  71. tmp += ptr;
  72. #endif
  73. return tmp;
  74. }
  75. static inline _Unwind_Reason_Code
  76. __gnu_unwind_24bit (_Unwind_Context * context __attribute__ ((unused)),
  77. _uw data __attribute__ ((unused)),
  78. int compact __attribute__ ((unused)))
  79. {
  80. return _URC_FAILURE;
  81. }
  82. #ifndef __FreeBSD__
  83. /* Return the address of the instruction, not the actual IP value. */
  84. #define _Unwind_GetIP(context) \
  85. (_Unwind_GetGR (context, 15) & ~(_Unwind_Word)1)
  86. #define _Unwind_SetIP(context, val) \
  87. _Unwind_SetGR (context, 15, val | (_Unwind_GetGR (context, 15) & 1))
  88. #else
  89. #undef _Unwind_GetIPInfo
  90. _Unwind_Ptr _Unwind_GetIP (struct _Unwind_Context *);
  91. _Unwind_Ptr _Unwind_GetIPInfo (struct _Unwind_Context *, int *);
  92. void _Unwind_SetIP (struct _Unwind_Context *, _Unwind_Ptr);
  93. #endif
  94. #ifdef __cplusplus
  95. } /* extern "C" */
  96. #endif
  97. #endif /* defined UNWIND_ARM_H */