* mmap.c (backtrace_free): If freeing a large aligned block of
[official-gcc.git] / libgcc / unwind-compat.c
blobbb54e809ef1881a7c7dcd602b9190fa2c772ce80
1 /* Backward compatibility unwind routines.
2 Copyright (C) 2004-2014 Free Software Foundation, Inc.
4 This file is part of GCC.
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.
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.
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.
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/>. */
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"
32 extern _Unwind_Reason_Code __libunwind_Unwind_Backtrace
33 (_Unwind_Trace_Fn, void *);
35 _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE
36 _Unwind_Backtrace (_Unwind_Trace_Fn trace, void *trace_argument)
38 return __libunwind_Unwind_Backtrace (trace, trace_argument);
40 symver (_Unwind_Backtrace, GCC_3.3);
42 extern void __libunwind_Unwind_DeleteException
43 (struct _Unwind_Exception *);
45 void
46 _Unwind_DeleteException (struct _Unwind_Exception *exc)
48 return __libunwind_Unwind_DeleteException (exc);
50 symver (_Unwind_DeleteException, GCC_3.0);
52 extern void * __libunwind_Unwind_FindEnclosingFunction (void *);
54 void *
55 _Unwind_FindEnclosingFunction (void *pc)
57 return __libunwind_Unwind_FindEnclosingFunction (pc);
59 symver (_Unwind_FindEnclosingFunction, GCC_3.3);
61 extern _Unwind_Reason_Code __libunwind_Unwind_ForcedUnwind
62 (struct _Unwind_Exception *, _Unwind_Stop_Fn, void *);
64 _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE
65 _Unwind_ForcedUnwind (struct _Unwind_Exception *exc,
66 _Unwind_Stop_Fn stop, void * stop_argument)
68 return __libunwind_Unwind_ForcedUnwind (exc, stop, stop_argument);
70 symver (_Unwind_ForcedUnwind, GCC_3.0);
72 extern _Unwind_Word __libunwind_Unwind_GetCFA
73 (struct _Unwind_Context *);
75 _Unwind_Word
76 _Unwind_GetCFA (struct _Unwind_Context *context)
78 return __libunwind_Unwind_GetCFA (context);
80 symver (_Unwind_GetCFA, GCC_3.3);
82 #ifdef __ia64__
83 extern _Unwind_Word __libunwind_Unwind_GetBSP
84 (struct _Unwind_Context *);
86 _Unwind_Word
87 _Unwind_GetBSP (struct _Unwind_Context * context)
89 return __libunwind_Unwind_GetBSP (context);
91 symver (_Unwind_GetBSP, GCC_3.3.2);
92 #else
93 extern _Unwind_Ptr __libunwind_Unwind_GetDataRelBase
94 (struct _Unwind_Context *);
96 _Unwind_Ptr
97 _Unwind_GetDataRelBase (struct _Unwind_Context *context)
99 return __libunwind_Unwind_GetDataRelBase (context);
101 symver (_Unwind_GetDataRelBase, GCC_3.0);
103 extern _Unwind_Ptr __libunwind_Unwind_GetTextRelBase
104 (struct _Unwind_Context *);
106 _Unwind_Ptr
107 _Unwind_GetTextRelBase (struct _Unwind_Context *context)
109 return __libunwind_Unwind_GetTextRelBase (context);
111 symver (_Unwind_GetTextRelBase, GCC_3.0);
112 #endif
114 extern _Unwind_Word __libunwind_Unwind_GetGR
115 (struct _Unwind_Context *, int );
117 _Unwind_Word
118 _Unwind_GetGR (struct _Unwind_Context *context, int index)
120 return __libunwind_Unwind_GetGR (context, index);
122 symver (_Unwind_GetGR, GCC_3.0);
124 extern _Unwind_Ptr __libunwind_Unwind_GetIP (struct _Unwind_Context *);
126 _Unwind_Ptr
127 _Unwind_GetIP (struct _Unwind_Context *context)
129 return __libunwind_Unwind_GetIP (context);
131 symver (_Unwind_GetIP, GCC_3.0);
133 _Unwind_Ptr
134 _Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
136 *ip_before_insn = 0;
137 return __libunwind_Unwind_GetIP (context);
140 extern void *__libunwind_Unwind_GetLanguageSpecificData
141 (struct _Unwind_Context *);
143 void *
144 _Unwind_GetLanguageSpecificData (struct _Unwind_Context *context)
146 return __libunwind_Unwind_GetLanguageSpecificData (context);
148 symver (_Unwind_GetLanguageSpecificData, GCC_3.0);
150 extern _Unwind_Ptr __libunwind_Unwind_GetRegionStart
151 (struct _Unwind_Context *);
153 _Unwind_Ptr
154 _Unwind_GetRegionStart (struct _Unwind_Context *context)
156 return __libunwind_Unwind_GetRegionStart (context);
158 symver (_Unwind_GetRegionStart, GCC_3.0);
160 extern _Unwind_Reason_Code __libunwind_Unwind_RaiseException
161 (struct _Unwind_Exception *);
163 _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE
164 _Unwind_RaiseException(struct _Unwind_Exception *exc)
166 return __libunwind_Unwind_RaiseException (exc);
168 symver (_Unwind_RaiseException, GCC_3.0);
170 extern void __libunwind_Unwind_Resume (struct _Unwind_Exception *);
172 void LIBGCC2_UNWIND_ATTRIBUTE
173 _Unwind_Resume (struct _Unwind_Exception *exc)
175 __libunwind_Unwind_Resume (exc);
177 symver (_Unwind_Resume, GCC_3.0);
179 extern _Unwind_Reason_Code __libunwind_Unwind_Resume_or_Rethrow
180 (struct _Unwind_Exception *);
182 _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE
183 _Unwind_Resume_or_Rethrow (struct _Unwind_Exception *exc)
185 return __libunwind_Unwind_Resume_or_Rethrow (exc);
187 symver (_Unwind_Resume_or_Rethrow, GCC_3.3);
189 extern void __libunwind_Unwind_SetGR
190 (struct _Unwind_Context *, int, _Unwind_Word);
192 void
193 _Unwind_SetGR (struct _Unwind_Context *context, int index,
194 _Unwind_Word val)
196 __libunwind_Unwind_SetGR (context, index, val);
198 symver (_Unwind_SetGR, GCC_3.0);
200 extern void __libunwind_Unwind_SetIP
201 (struct _Unwind_Context *, _Unwind_Ptr);
203 void
204 _Unwind_SetIP (struct _Unwind_Context *context, _Unwind_Ptr val)
206 return __libunwind_Unwind_SetIP (context, val);
208 symver (_Unwind_SetIP, GCC_3.0);
209 #endif