unwind-compat.c 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. /* Backward compatibility unwind routines.
  2. Copyright (C) 2004-2022 Free Software Foundation, Inc.
  3. This file is part of GCC.
  4. GCC is free software; you can redistribute it and/or modify it
  5. under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3, or (at your option)
  7. any later version.
  8. GCC is distributed in the hope that it will be useful, but WITHOUT
  9. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  10. or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
  11. 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. #if defined (USE_GAS_SYMVER) && defined (USE_LIBUNWIND_EXCEPTIONS)
  20. #include "tconfig.h"
  21. #include "tsystem.h"
  22. #include "unwind.h"
  23. #include "unwind-dw2-fde.h"
  24. #include "unwind-compat.h"
  25. extern _Unwind_Reason_Code __libunwind_Unwind_Backtrace
  26. (_Unwind_Trace_Fn, void *);
  27. _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE
  28. _Unwind_Backtrace (_Unwind_Trace_Fn trace, void *trace_argument)
  29. {
  30. return __libunwind_Unwind_Backtrace (trace, trace_argument);
  31. }
  32. symver (_Unwind_Backtrace, GCC_3.3);
  33. extern void __libunwind_Unwind_DeleteException
  34. (struct _Unwind_Exception *);
  35. void
  36. _Unwind_DeleteException (struct _Unwind_Exception *exc)
  37. {
  38. return __libunwind_Unwind_DeleteException (exc);
  39. }
  40. symver (_Unwind_DeleteException, GCC_3.0);
  41. extern void * __libunwind_Unwind_FindEnclosingFunction (void *);
  42. void *
  43. _Unwind_FindEnclosingFunction (void *pc)
  44. {
  45. return __libunwind_Unwind_FindEnclosingFunction (pc);
  46. }
  47. symver (_Unwind_FindEnclosingFunction, GCC_3.3);
  48. extern _Unwind_Reason_Code __libunwind_Unwind_ForcedUnwind
  49. (struct _Unwind_Exception *, _Unwind_Stop_Fn, void *);
  50. _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE
  51. _Unwind_ForcedUnwind (struct _Unwind_Exception *exc,
  52. _Unwind_Stop_Fn stop, void * stop_argument)
  53. {
  54. return __libunwind_Unwind_ForcedUnwind (exc, stop, stop_argument);
  55. }
  56. symver (_Unwind_ForcedUnwind, GCC_3.0);
  57. extern _Unwind_Word __libunwind_Unwind_GetCFA
  58. (struct _Unwind_Context *);
  59. _Unwind_Word
  60. _Unwind_GetCFA (struct _Unwind_Context *context)
  61. {
  62. return __libunwind_Unwind_GetCFA (context);
  63. }
  64. symver (_Unwind_GetCFA, GCC_3.3);
  65. #ifdef __ia64__
  66. extern _Unwind_Word __libunwind_Unwind_GetBSP
  67. (struct _Unwind_Context *);
  68. _Unwind_Word
  69. _Unwind_GetBSP (struct _Unwind_Context * context)
  70. {
  71. return __libunwind_Unwind_GetBSP (context);
  72. }
  73. symver (_Unwind_GetBSP, GCC_3.3.2);
  74. #else
  75. extern _Unwind_Ptr __libunwind_Unwind_GetDataRelBase
  76. (struct _Unwind_Context *);
  77. _Unwind_Ptr
  78. _Unwind_GetDataRelBase (struct _Unwind_Context *context)
  79. {
  80. return __libunwind_Unwind_GetDataRelBase (context);
  81. }
  82. symver (_Unwind_GetDataRelBase, GCC_3.0);
  83. extern _Unwind_Ptr __libunwind_Unwind_GetTextRelBase
  84. (struct _Unwind_Context *);
  85. _Unwind_Ptr
  86. _Unwind_GetTextRelBase (struct _Unwind_Context *context)
  87. {
  88. return __libunwind_Unwind_GetTextRelBase (context);
  89. }
  90. symver (_Unwind_GetTextRelBase, GCC_3.0);
  91. #endif
  92. extern _Unwind_Word __libunwind_Unwind_GetGR
  93. (struct _Unwind_Context *, int );
  94. _Unwind_Word
  95. _Unwind_GetGR (struct _Unwind_Context *context, int index)
  96. {
  97. return __libunwind_Unwind_GetGR (context, index);
  98. }
  99. symver (_Unwind_GetGR, GCC_3.0);
  100. extern _Unwind_Ptr __libunwind_Unwind_GetIP (struct _Unwind_Context *);
  101. _Unwind_Ptr
  102. _Unwind_GetIP (struct _Unwind_Context *context)
  103. {
  104. return __libunwind_Unwind_GetIP (context);
  105. }
  106. symver (_Unwind_GetIP, GCC_3.0);
  107. _Unwind_Ptr
  108. _Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
  109. {
  110. *ip_before_insn = 0;
  111. return __libunwind_Unwind_GetIP (context);
  112. }
  113. extern void *__libunwind_Unwind_GetLanguageSpecificData
  114. (struct _Unwind_Context *);
  115. void *
  116. _Unwind_GetLanguageSpecificData (struct _Unwind_Context *context)
  117. {
  118. return __libunwind_Unwind_GetLanguageSpecificData (context);
  119. }
  120. symver (_Unwind_GetLanguageSpecificData, GCC_3.0);
  121. extern _Unwind_Ptr __libunwind_Unwind_GetRegionStart
  122. (struct _Unwind_Context *);
  123. _Unwind_Ptr
  124. _Unwind_GetRegionStart (struct _Unwind_Context *context)
  125. {
  126. return __libunwind_Unwind_GetRegionStart (context);
  127. }
  128. symver (_Unwind_GetRegionStart, GCC_3.0);
  129. extern _Unwind_Reason_Code __libunwind_Unwind_RaiseException
  130. (struct _Unwind_Exception *);
  131. _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE
  132. _Unwind_RaiseException(struct _Unwind_Exception *exc)
  133. {
  134. return __libunwind_Unwind_RaiseException (exc);
  135. }
  136. symver (_Unwind_RaiseException, GCC_3.0);
  137. extern void __libunwind_Unwind_Resume (struct _Unwind_Exception *);
  138. void LIBGCC2_UNWIND_ATTRIBUTE
  139. _Unwind_Resume (struct _Unwind_Exception *exc)
  140. {
  141. __libunwind_Unwind_Resume (exc);
  142. }
  143. symver (_Unwind_Resume, GCC_3.0);
  144. extern _Unwind_Reason_Code __libunwind_Unwind_Resume_or_Rethrow
  145. (struct _Unwind_Exception *);
  146. _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE
  147. _Unwind_Resume_or_Rethrow (struct _Unwind_Exception *exc)
  148. {
  149. return __libunwind_Unwind_Resume_or_Rethrow (exc);
  150. }
  151. symver (_Unwind_Resume_or_Rethrow, GCC_3.3);
  152. extern void __libunwind_Unwind_SetGR
  153. (struct _Unwind_Context *, int, _Unwind_Word);
  154. void
  155. _Unwind_SetGR (struct _Unwind_Context *context, int index,
  156. _Unwind_Word val)
  157. {
  158. __libunwind_Unwind_SetGR (context, index, val);
  159. }
  160. symver (_Unwind_SetGR, GCC_3.0);
  161. extern void __libunwind_Unwind_SetIP
  162. (struct _Unwind_Context *, _Unwind_Ptr);
  163. void
  164. _Unwind_SetIP (struct _Unwind_Context *context, _Unwind_Ptr val)
  165. {
  166. return __libunwind_Unwind_SetIP (context, val);
  167. }
  168. symver (_Unwind_SetIP, GCC_3.0);
  169. #endif