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