2010-11-24 Tobias Burnus <burnus@net-b.de>
[official-gcc.git] / gcc / unwind-compat.c
blob5b41f24688deebd1ef922340e905aa3cd497c6e0
1 /* Backward compatibility unwind routines.
2 Copyright (C) 2004, 2005, 2006, 2009
3 Free Software Foundation, Inc.
5 This file is part of GCC.
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 3, or (at your option)
10 any later version.
12 GCC is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 License for more details.
17 Under Section 7 of GPL version 3, you are granted additional
18 permissions described in the GCC Runtime Library Exception, version
19 3.1, as published by the Free Software Foundation.
21 You should have received a copy of the GNU General Public License and
22 a copy of the GCC Runtime Library Exception along with this program;
23 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
24 <http://www.gnu.org/licenses/>. */
26 #if defined (USE_GAS_SYMVER) && defined (USE_LIBUNWIND_EXCEPTIONS)
27 #include "tconfig.h"
28 #include "tsystem.h"
29 #include "unwind.h"
30 #include "unwind-dw2-fde.h"
31 #include "unwind-compat.h"
33 extern _Unwind_Reason_Code __libunwind_Unwind_Backtrace
34 (_Unwind_Trace_Fn, void *);
36 _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE
37 _Unwind_Backtrace (_Unwind_Trace_Fn trace, void *trace_argument)
39 return __libunwind_Unwind_Backtrace (trace, trace_argument);
41 symver (_Unwind_Backtrace, GCC_3.3);
43 extern void __libunwind_Unwind_DeleteException
44 (struct _Unwind_Exception *);
46 void
47 _Unwind_DeleteException (struct _Unwind_Exception *exc)
49 return __libunwind_Unwind_DeleteException (exc);
51 symver (_Unwind_DeleteException, GCC_3.0);
53 extern void * __libunwind_Unwind_FindEnclosingFunction (void *);
55 void *
56 _Unwind_FindEnclosingFunction (void *pc)
58 return __libunwind_Unwind_FindEnclosingFunction (pc);
60 symver (_Unwind_FindEnclosingFunction, GCC_3.3);
62 extern _Unwind_Reason_Code __libunwind_Unwind_ForcedUnwind
63 (struct _Unwind_Exception *, _Unwind_Stop_Fn, void *);
65 _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE
66 _Unwind_ForcedUnwind (struct _Unwind_Exception *exc,
67 _Unwind_Stop_Fn stop, void * stop_argument)
69 return __libunwind_Unwind_ForcedUnwind (exc, stop, stop_argument);
71 symver (_Unwind_ForcedUnwind, GCC_3.0);
73 extern _Unwind_Word __libunwind_Unwind_GetCFA
74 (struct _Unwind_Context *);
76 _Unwind_Word
77 _Unwind_GetCFA (struct _Unwind_Context *context)
79 return __libunwind_Unwind_GetCFA (context);
81 symver (_Unwind_GetCFA, GCC_3.3);
83 #ifdef __ia64__
84 extern _Unwind_Word __libunwind_Unwind_GetBSP
85 (struct _Unwind_Context *);
87 _Unwind_Word
88 _Unwind_GetBSP (struct _Unwind_Context * context)
90 return __libunwind_Unwind_GetBSP (context);
92 symver (_Unwind_GetBSP, GCC_3.3.2);
93 #else
94 extern _Unwind_Ptr __libunwind_Unwind_GetDataRelBase
95 (struct _Unwind_Context *);
97 _Unwind_Ptr
98 _Unwind_GetDataRelBase (struct _Unwind_Context *context)
100 return __libunwind_Unwind_GetDataRelBase (context);
102 symver (_Unwind_GetDataRelBase, GCC_3.0);
104 extern _Unwind_Ptr __libunwind_Unwind_GetTextRelBase
105 (struct _Unwind_Context *);
107 _Unwind_Ptr
108 _Unwind_GetTextRelBase (struct _Unwind_Context *context)
110 return __libunwind_Unwind_GetTextRelBase (context);
112 symver (_Unwind_GetTextRelBase, GCC_3.0);
113 #endif
115 extern _Unwind_Word __libunwind_Unwind_GetGR
116 (struct _Unwind_Context *, int );
118 _Unwind_Word
119 _Unwind_GetGR (struct _Unwind_Context *context, int index)
121 return __libunwind_Unwind_GetGR (context, index);
123 symver (_Unwind_GetGR, GCC_3.0);
125 extern _Unwind_Ptr __libunwind_Unwind_GetIP (struct _Unwind_Context *);
127 _Unwind_Ptr
128 _Unwind_GetIP (struct _Unwind_Context *context)
130 return __libunwind_Unwind_GetIP (context);
132 symver (_Unwind_GetIP, GCC_3.0);
134 _Unwind_Ptr
135 _Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
137 *ip_before_insn = 0;
138 return __libunwind_Unwind_GetIP (context);
141 extern void *__libunwind_Unwind_GetLanguageSpecificData
142 (struct _Unwind_Context *);
144 void *
145 _Unwind_GetLanguageSpecificData (struct _Unwind_Context *context)
147 return __libunwind_Unwind_GetLanguageSpecificData (context);
149 symver (_Unwind_GetLanguageSpecificData, GCC_3.0);
151 extern _Unwind_Ptr __libunwind_Unwind_GetRegionStart
152 (struct _Unwind_Context *);
154 _Unwind_Ptr
155 _Unwind_GetRegionStart (struct _Unwind_Context *context)
157 return __libunwind_Unwind_GetRegionStart (context);
159 symver (_Unwind_GetRegionStart, GCC_3.0);
161 extern _Unwind_Reason_Code __libunwind_Unwind_RaiseException
162 (struct _Unwind_Exception *);
164 _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE
165 _Unwind_RaiseException(struct _Unwind_Exception *exc)
167 return __libunwind_Unwind_RaiseException (exc);
169 symver (_Unwind_RaiseException, GCC_3.0);
171 extern void __libunwind_Unwind_Resume (struct _Unwind_Exception *);
173 void LIBGCC2_UNWIND_ATTRIBUTE
174 _Unwind_Resume (struct _Unwind_Exception *exc)
176 __libunwind_Unwind_Resume (exc);
178 symver (_Unwind_Resume, GCC_3.0);
180 extern _Unwind_Reason_Code __libunwind_Unwind_Resume_or_Rethrow
181 (struct _Unwind_Exception *);
183 _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE
184 _Unwind_Resume_or_Rethrow (struct _Unwind_Exception *exc)
186 return __libunwind_Unwind_Resume_or_Rethrow (exc);
188 symver (_Unwind_Resume_or_Rethrow, GCC_3.3);
190 extern void __libunwind_Unwind_SetGR
191 (struct _Unwind_Context *, int, _Unwind_Word);
193 void
194 _Unwind_SetGR (struct _Unwind_Context *context, int index,
195 _Unwind_Word val)
197 __libunwind_Unwind_SetGR (context, index, val);
199 symver (_Unwind_SetGR, GCC_3.0);
201 extern void __libunwind_Unwind_SetIP
202 (struct _Unwind_Context *, _Unwind_Ptr);
204 void
205 _Unwind_SetIP (struct _Unwind_Context *context, _Unwind_Ptr val)
207 return __libunwind_Unwind_SetIP (context, val);
209 symver (_Unwind_SetIP, GCC_3.0);
210 #endif