xref: /openbsd-src/gnu/gcc/gcc/unwind-compat.c (revision 404b540a9034ac75a6199ad1a32d1bbc7a0d4210)
1 /* Backward compatibility unwind routines.
2    Copyright (C) 2004, 2005, 2006
3    Free Software Foundation, Inc.
4 
5    This file is part of GCC.
6 
7    GCC is free software; you can redistribute it and/or modify it
8    under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2, or (at your option)
10    any later version.
11 
12    In addition to the permissions in the GNU General Public License, the
13    Free Software Foundation gives you unlimited permission to link the
14    compiled version of this file into combinations with other programs,
15    and to distribute those combinations without any restriction coming
16    from the use of this file.  (The General Public License restrictions
17    do apply in other respects; for example, they cover modification of
18    the file, and distribution when not linked into a combined
19    executable.)
20 
21    GCC is distributed in the hope that it will be useful, but WITHOUT
22    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
23    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
24    License for more details.
25 
26    You should have received a copy of the GNU General Public License
27    along with GCC; see the file COPYING.  If not, write to the Free
28    Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
29    02110-1301, USA.  */
30 
31 #if defined (USE_GAS_SYMVER) && defined (USE_LIBUNWIND_EXCEPTIONS)
32 #include "tconfig.h"
33 #include "tsystem.h"
34 #include "unwind.h"
35 #include "unwind-dw2-fde.h"
36 #include "unwind-compat.h"
37 
38 extern _Unwind_Reason_Code __libunwind_Unwind_Backtrace
39   (_Unwind_Trace_Fn, void *);
40 
41 _Unwind_Reason_Code
_Unwind_Backtrace(_Unwind_Trace_Fn trace,void * trace_argument)42 _Unwind_Backtrace (_Unwind_Trace_Fn trace, void *trace_argument)
43 {
44   return __libunwind_Unwind_Backtrace (trace, trace_argument);
45 }
46 symver (_Unwind_Backtrace, GCC_3.3);
47 
48 extern void __libunwind_Unwind_DeleteException
49   (struct _Unwind_Exception *);
50 
51 void
_Unwind_DeleteException(struct _Unwind_Exception * exc)52 _Unwind_DeleteException (struct _Unwind_Exception *exc)
53 {
54   return __libunwind_Unwind_DeleteException (exc);
55 }
56 symver (_Unwind_DeleteException, GCC_3.0);
57 
58 extern void * __libunwind_Unwind_FindEnclosingFunction (void *);
59 
60 void *
_Unwind_FindEnclosingFunction(void * pc)61 _Unwind_FindEnclosingFunction (void *pc)
62 {
63   return __libunwind_Unwind_FindEnclosingFunction (pc);
64 }
65 symver (_Unwind_FindEnclosingFunction, GCC_3.3);
66 
67 extern _Unwind_Reason_Code __libunwind_Unwind_ForcedUnwind
68   (struct _Unwind_Exception *, _Unwind_Stop_Fn, void *);
69 
70 _Unwind_Reason_Code
_Unwind_ForcedUnwind(struct _Unwind_Exception * exc,_Unwind_Stop_Fn stop,void * stop_argument)71 _Unwind_ForcedUnwind (struct _Unwind_Exception *exc,
72 		      _Unwind_Stop_Fn stop, void * stop_argument)
73 {
74   return __libunwind_Unwind_ForcedUnwind (exc, stop, stop_argument);
75 }
76 symver (_Unwind_ForcedUnwind, GCC_3.0);
77 
78 extern _Unwind_Word __libunwind_Unwind_GetCFA
79   (struct _Unwind_Context *);
80 
81 _Unwind_Word
_Unwind_GetCFA(struct _Unwind_Context * context)82 _Unwind_GetCFA (struct _Unwind_Context *context)
83 {
84   return __libunwind_Unwind_GetCFA (context);
85 }
86 symver (_Unwind_GetCFA, GCC_3.3);
87 
88 #ifdef __ia64__
89 extern _Unwind_Word __libunwind_Unwind_GetBSP
90   (struct _Unwind_Context *);
91 
92 _Unwind_Word
_Unwind_GetBSP(struct _Unwind_Context * context)93 _Unwind_GetBSP (struct _Unwind_Context * context)
94 {
95   return __libunwind_Unwind_GetBSP (context);
96 }
97 symver (_Unwind_GetBSP, GCC_3.3.2);
98 #else
99 extern _Unwind_Ptr __libunwind_Unwind_GetDataRelBase
100   (struct _Unwind_Context *);
101 
102 _Unwind_Ptr
_Unwind_GetDataRelBase(struct _Unwind_Context * context)103 _Unwind_GetDataRelBase (struct _Unwind_Context *context)
104 {
105   return __libunwind_Unwind_GetDataRelBase (context);
106 }
107 symver (_Unwind_GetDataRelBase, GCC_3.0);
108 
109 extern _Unwind_Ptr __libunwind_Unwind_GetTextRelBase
110   (struct _Unwind_Context *);
111 
112 _Unwind_Ptr
_Unwind_GetTextRelBase(struct _Unwind_Context * context)113 _Unwind_GetTextRelBase (struct _Unwind_Context *context)
114 {
115   return __libunwind_Unwind_GetTextRelBase (context);
116 }
117 symver (_Unwind_GetTextRelBase, GCC_3.0);
118 #endif
119 
120 extern _Unwind_Word __libunwind_Unwind_GetGR
121   (struct _Unwind_Context *, int );
122 
123 _Unwind_Word
_Unwind_GetGR(struct _Unwind_Context * context,int index)124 _Unwind_GetGR (struct _Unwind_Context *context, int index)
125 {
126   return __libunwind_Unwind_GetGR (context, index);
127 }
128 symver (_Unwind_GetGR, GCC_3.0);
129 
130 extern _Unwind_Ptr __libunwind_Unwind_GetIP (struct _Unwind_Context *);
131 
132 _Unwind_Ptr
_Unwind_GetIP(struct _Unwind_Context * context)133 _Unwind_GetIP (struct _Unwind_Context *context)
134 {
135   return __libunwind_Unwind_GetIP (context);
136 }
137 symver (_Unwind_GetIP, GCC_3.0);
138 
139 _Unwind_Ptr
_Unwind_GetIPInfo(struct _Unwind_Context * context,int * ip_before_insn)140 _Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
141 {
142   *ip_before_insn = 0;
143   return __libunwind_Unwind_GetIP (context);
144 }
145 
146 extern void *__libunwind_Unwind_GetLanguageSpecificData
147   (struct _Unwind_Context *);
148 
149 void *
_Unwind_GetLanguageSpecificData(struct _Unwind_Context * context)150 _Unwind_GetLanguageSpecificData (struct _Unwind_Context *context)
151 {
152   return __libunwind_Unwind_GetLanguageSpecificData (context);
153 }
154 symver (_Unwind_GetLanguageSpecificData, GCC_3.0);
155 
156 extern _Unwind_Ptr __libunwind_Unwind_GetRegionStart
157   (struct _Unwind_Context *);
158 
159 _Unwind_Ptr
_Unwind_GetRegionStart(struct _Unwind_Context * context)160 _Unwind_GetRegionStart (struct _Unwind_Context *context)
161 {
162   return __libunwind_Unwind_GetRegionStart (context);
163 }
164 symver (_Unwind_GetRegionStart, GCC_3.0);
165 
166 extern _Unwind_Reason_Code __libunwind_Unwind_RaiseException
167   (struct _Unwind_Exception *);
168 
169 _Unwind_Reason_Code
_Unwind_RaiseException(struct _Unwind_Exception * exc)170 _Unwind_RaiseException(struct _Unwind_Exception *exc)
171 {
172   return __libunwind_Unwind_RaiseException (exc);
173 }
174 symver (_Unwind_RaiseException, GCC_3.0);
175 
176 extern void __libunwind_Unwind_Resume (struct _Unwind_Exception *);
177 
178 void
_Unwind_Resume(struct _Unwind_Exception * exc)179 _Unwind_Resume (struct _Unwind_Exception *exc)
180 {
181   __libunwind_Unwind_Resume (exc);
182 }
183 symver (_Unwind_Resume, GCC_3.0);
184 
185 extern _Unwind_Reason_Code __libunwind_Unwind_Resume_or_Rethrow
186    (struct _Unwind_Exception *);
187 
188 _Unwind_Reason_Code
_Unwind_Resume_or_Rethrow(struct _Unwind_Exception * exc)189 _Unwind_Resume_or_Rethrow (struct _Unwind_Exception *exc)
190 {
191   return __libunwind_Unwind_Resume_or_Rethrow (exc);
192 }
193 symver (_Unwind_Resume_or_Rethrow, GCC_3.3);
194 
195 extern void __libunwind_Unwind_SetGR
196   (struct _Unwind_Context *, int, _Unwind_Word);
197 
198 void
_Unwind_SetGR(struct _Unwind_Context * context,int index,_Unwind_Word val)199 _Unwind_SetGR (struct _Unwind_Context *context, int index,
200 	       _Unwind_Word val)
201 {
202   __libunwind_Unwind_SetGR (context, index, val);
203 }
204 symver (_Unwind_SetGR, GCC_3.0);
205 
206 extern void __libunwind_Unwind_SetIP
207   (struct _Unwind_Context *, _Unwind_Ptr);
208 
209 void
_Unwind_SetIP(struct _Unwind_Context * context,_Unwind_Ptr val)210 _Unwind_SetIP (struct _Unwind_Context *context, _Unwind_Ptr val)
211 {
212   return __libunwind_Unwind_SetIP (context, val);
213 }
214 symver (_Unwind_SetIP, GCC_3.0);
215 #endif
216