1146895Skan/* Backward compatibility unwind routines.
2169689Skan   Copyright (C) 2004, 2005, 2006
3146895Skan   Free Software Foundation, Inc.
4146895Skan
5146895Skan   This file is part of GCC.
6146895Skan
7146895Skan   GCC is free software; you can redistribute it and/or modify it
8146895Skan   under the terms of the GNU General Public License as published by
9146895Skan   the Free Software Foundation; either version 2, or (at your option)
10146895Skan   any later version.
11146895Skan
12146895Skan   In addition to the permissions in the GNU General Public License, the
13146895Skan   Free Software Foundation gives you unlimited permission to link the
14146895Skan   compiled version of this file into combinations with other programs,
15146895Skan   and to distribute those combinations without any restriction coming
16146895Skan   from the use of this file.  (The General Public License restrictions
17146895Skan   do apply in other respects; for example, they cover modification of
18146895Skan   the file, and distribution when not linked into a combined
19146895Skan   executable.)
20146895Skan
21146895Skan   GCC is distributed in the hope that it will be useful, but WITHOUT
22146895Skan   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
23146895Skan   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
24146895Skan   License for more details.
25146895Skan
26146895Skan   You should have received a copy of the GNU General Public License
27146895Skan   along with GCC; see the file COPYING.  If not, write to the Free
28169689Skan   Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
29169689Skan   02110-1301, USA.  */
30146895Skan
31146895Skan#if defined (USE_GAS_SYMVER) && defined (USE_LIBUNWIND_EXCEPTIONS)
32169689Skan#include "tconfig.h"
33169689Skan#include "tsystem.h"
34146895Skan#include "unwind.h"
35146895Skan#include "unwind-dw2-fde.h"
36146895Skan#include "unwind-compat.h"
37146895Skan
38146895Skanextern _Unwind_Reason_Code __libunwind_Unwind_Backtrace
39146895Skan  (_Unwind_Trace_Fn, void *);
40146895Skan
41146895Skan_Unwind_Reason_Code
42146895Skan_Unwind_Backtrace (_Unwind_Trace_Fn trace, void *trace_argument)
43146895Skan{
44146895Skan  return __libunwind_Unwind_Backtrace (trace, trace_argument);
45146895Skan}
46146895Skansymver (_Unwind_Backtrace, GCC_3.3);
47146895Skan
48146895Skanextern void __libunwind_Unwind_DeleteException
49146895Skan  (struct _Unwind_Exception *);
50146895Skan
51146895Skanvoid
52146895Skan_Unwind_DeleteException (struct _Unwind_Exception *exc)
53146895Skan{
54146895Skan  return __libunwind_Unwind_DeleteException (exc);
55146895Skan}
56146895Skansymver (_Unwind_DeleteException, GCC_3.0);
57146895Skan
58146895Skanextern void * __libunwind_Unwind_FindEnclosingFunction (void *);
59146895Skan
60146895Skanvoid *
61146895Skan_Unwind_FindEnclosingFunction (void *pc)
62146895Skan{
63146895Skan  return __libunwind_Unwind_FindEnclosingFunction (pc);
64146895Skan}
65146895Skansymver (_Unwind_FindEnclosingFunction, GCC_3.3);
66146895Skan
67146895Skanextern _Unwind_Reason_Code __libunwind_Unwind_ForcedUnwind
68146895Skan  (struct _Unwind_Exception *, _Unwind_Stop_Fn, void *);
69146895Skan
70146895Skan_Unwind_Reason_Code
71146895Skan_Unwind_ForcedUnwind (struct _Unwind_Exception *exc,
72146895Skan		      _Unwind_Stop_Fn stop, void * stop_argument)
73146895Skan{
74146895Skan  return __libunwind_Unwind_ForcedUnwind (exc, stop, stop_argument);
75146895Skan}
76146895Skansymver (_Unwind_ForcedUnwind, GCC_3.0);
77146895Skan
78146895Skanextern _Unwind_Word __libunwind_Unwind_GetCFA
79146895Skan  (struct _Unwind_Context *);
80146895Skan
81146895Skan_Unwind_Word
82146895Skan_Unwind_GetCFA (struct _Unwind_Context *context)
83146895Skan{
84146895Skan  return __libunwind_Unwind_GetCFA (context);
85146895Skan}
86146895Skansymver (_Unwind_GetCFA, GCC_3.3);
87146895Skan
88146895Skan#ifdef __ia64__
89146895Skanextern _Unwind_Word __libunwind_Unwind_GetBSP
90146895Skan  (struct _Unwind_Context *);
91146895Skan
92146895Skan_Unwind_Word
93146895Skan_Unwind_GetBSP (struct _Unwind_Context * context)
94146895Skan{
95146895Skan  return __libunwind_Unwind_GetBSP (context);
96146895Skan}
97146895Skansymver (_Unwind_GetBSP, GCC_3.3.2);
98146895Skan#else
99146895Skanextern _Unwind_Ptr __libunwind_Unwind_GetDataRelBase
100146895Skan  (struct _Unwind_Context *);
101146895Skan
102146895Skan_Unwind_Ptr
103146895Skan_Unwind_GetDataRelBase (struct _Unwind_Context *context)
104146895Skan{
105146895Skan  return __libunwind_Unwind_GetDataRelBase (context);
106146895Skan}
107146895Skansymver (_Unwind_GetDataRelBase, GCC_3.0);
108146895Skan
109146895Skanextern _Unwind_Ptr __libunwind_Unwind_GetTextRelBase
110146895Skan  (struct _Unwind_Context *);
111146895Skan
112146895Skan_Unwind_Ptr
113146895Skan_Unwind_GetTextRelBase (struct _Unwind_Context *context)
114146895Skan{
115146895Skan  return __libunwind_Unwind_GetTextRelBase (context);
116146895Skan}
117146895Skansymver (_Unwind_GetTextRelBase, GCC_3.0);
118146895Skan#endif
119146895Skan
120146895Skanextern _Unwind_Word __libunwind_Unwind_GetGR
121146895Skan  (struct _Unwind_Context *, int );
122146895Skan
123146895Skan_Unwind_Word
124146895Skan_Unwind_GetGR (struct _Unwind_Context *context, int index)
125146895Skan{
126146895Skan  return __libunwind_Unwind_GetGR (context, index);
127146895Skan}
128146895Skansymver (_Unwind_GetGR, GCC_3.0);
129146895Skan
130146895Skanextern _Unwind_Ptr __libunwind_Unwind_GetIP (struct _Unwind_Context *);
131146895Skan
132146895Skan_Unwind_Ptr
133146895Skan_Unwind_GetIP (struct _Unwind_Context *context)
134146895Skan{
135146895Skan  return __libunwind_Unwind_GetIP (context);
136146895Skan}
137146895Skansymver (_Unwind_GetIP, GCC_3.0);
138146895Skan
139169689Skan_Unwind_Ptr
140169689Skan_Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
141169689Skan{
142169689Skan  *ip_before_insn = 0;
143169689Skan  return __libunwind_Unwind_GetIP (context);
144169689Skan}
145169689Skan
146146895Skanextern void *__libunwind_Unwind_GetLanguageSpecificData
147146895Skan  (struct _Unwind_Context *);
148146895Skan
149146895Skanvoid *
150146895Skan_Unwind_GetLanguageSpecificData (struct _Unwind_Context *context)
151146895Skan{
152146895Skan  return __libunwind_Unwind_GetLanguageSpecificData (context);
153146895Skan}
154146895Skansymver (_Unwind_GetLanguageSpecificData, GCC_3.0);
155146895Skan
156146895Skanextern _Unwind_Ptr __libunwind_Unwind_GetRegionStart
157146895Skan  (struct _Unwind_Context *);
158146895Skan
159146895Skan_Unwind_Ptr
160146895Skan_Unwind_GetRegionStart (struct _Unwind_Context *context)
161146895Skan{
162146895Skan  return __libunwind_Unwind_GetRegionStart (context);
163146895Skan}
164146895Skansymver (_Unwind_GetRegionStart, GCC_3.0);
165146895Skan
166146895Skanextern _Unwind_Reason_Code __libunwind_Unwind_RaiseException
167146895Skan  (struct _Unwind_Exception *);
168146895Skan
169146895Skan_Unwind_Reason_Code
170146895Skan_Unwind_RaiseException(struct _Unwind_Exception *exc)
171146895Skan{
172146895Skan  return __libunwind_Unwind_RaiseException (exc);
173146895Skan}
174146895Skansymver (_Unwind_RaiseException, GCC_3.0);
175146895Skan
176146895Skanextern void __libunwind_Unwind_Resume (struct _Unwind_Exception *);
177146895Skan
178146895Skanvoid
179146895Skan_Unwind_Resume (struct _Unwind_Exception *exc)
180146895Skan{
181146895Skan  __libunwind_Unwind_Resume (exc);
182146895Skan}
183146895Skansymver (_Unwind_Resume, GCC_3.0);
184146895Skan
185146895Skanextern _Unwind_Reason_Code __libunwind_Unwind_Resume_or_Rethrow
186146895Skan   (struct _Unwind_Exception *);
187146895Skan
188146895Skan_Unwind_Reason_Code
189146895Skan_Unwind_Resume_or_Rethrow (struct _Unwind_Exception *exc)
190146895Skan{
191146895Skan  return __libunwind_Unwind_Resume_or_Rethrow (exc);
192146895Skan}
193146895Skansymver (_Unwind_Resume_or_Rethrow, GCC_3.3);
194146895Skan
195146895Skanextern void __libunwind_Unwind_SetGR
196146895Skan  (struct _Unwind_Context *, int, _Unwind_Word);
197146895Skan
198146895Skanvoid
199146895Skan_Unwind_SetGR (struct _Unwind_Context *context, int index,
200146895Skan	       _Unwind_Word val)
201146895Skan{
202146895Skan  __libunwind_Unwind_SetGR (context, index, val);
203146895Skan}
204146895Skansymver (_Unwind_SetGR, GCC_3.0);
205146895Skan
206146895Skanextern void __libunwind_Unwind_SetIP
207146895Skan  (struct _Unwind_Context *, _Unwind_Ptr);
208146895Skan
209146895Skanvoid
210146895Skan_Unwind_SetIP (struct _Unwind_Context *context, _Unwind_Ptr val)
211146895Skan{
212146895Skan  return __libunwind_Unwind_SetIP (context, val);
213146895Skan}
214146895Skansymver (_Unwind_SetIP, GCC_3.0);
215146895Skan#endif
216