1 /* Backward compatibility unwind routines. 2 Copyright (C) 2004, 2005, 2006, 2009 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 3, or (at your option) 10 any later version. 11 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. 16 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. 20 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/>. */ 25 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" 32 33 extern _Unwind_Reason_Code __libunwind_Unwind_Backtrace 34 (_Unwind_Trace_Fn, void *); 35 36 _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE 37 _Unwind_Backtrace (_Unwind_Trace_Fn trace, void *trace_argument) 38 { 39 return __libunwind_Unwind_Backtrace (trace, trace_argument); 40 } 41 symver (_Unwind_Backtrace, GCC_3.3); 42 43 extern void __libunwind_Unwind_DeleteException 44 (struct _Unwind_Exception *); 45 46 void 47 _Unwind_DeleteException (struct _Unwind_Exception *exc) 48 { 49 return __libunwind_Unwind_DeleteException (exc); 50 } 51 symver (_Unwind_DeleteException, GCC_3.0); 52 53 extern void * __libunwind_Unwind_FindEnclosingFunction (void *); 54 55 void * 56 _Unwind_FindEnclosingFunction (void *pc) 57 { 58 return __libunwind_Unwind_FindEnclosingFunction (pc); 59 } 60 symver (_Unwind_FindEnclosingFunction, GCC_3.3); 61 62 extern _Unwind_Reason_Code __libunwind_Unwind_ForcedUnwind 63 (struct _Unwind_Exception *, _Unwind_Stop_Fn, void *); 64 65 _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE 66 _Unwind_ForcedUnwind (struct _Unwind_Exception *exc, 67 _Unwind_Stop_Fn stop, void * stop_argument) 68 { 69 return __libunwind_Unwind_ForcedUnwind (exc, stop, stop_argument); 70 } 71 symver (_Unwind_ForcedUnwind, GCC_3.0); 72 73 extern _Unwind_Word __libunwind_Unwind_GetCFA 74 (struct _Unwind_Context *); 75 76 _Unwind_Word 77 _Unwind_GetCFA (struct _Unwind_Context *context) 78 { 79 return __libunwind_Unwind_GetCFA (context); 80 } 81 symver (_Unwind_GetCFA, GCC_3.3); 82 83 #ifdef __ia64__ 84 extern _Unwind_Word __libunwind_Unwind_GetBSP 85 (struct _Unwind_Context *); 86 87 _Unwind_Word 88 _Unwind_GetBSP (struct _Unwind_Context * context) 89 { 90 return __libunwind_Unwind_GetBSP (context); 91 } 92 symver (_Unwind_GetBSP, GCC_3.3.2); 93 #else 94 extern _Unwind_Ptr __libunwind_Unwind_GetDataRelBase 95 (struct _Unwind_Context *); 96 97 _Unwind_Ptr 98 _Unwind_GetDataRelBase (struct _Unwind_Context *context) 99 { 100 return __libunwind_Unwind_GetDataRelBase (context); 101 } 102 symver (_Unwind_GetDataRelBase, GCC_3.0); 103 104 extern _Unwind_Ptr __libunwind_Unwind_GetTextRelBase 105 (struct _Unwind_Context *); 106 107 _Unwind_Ptr 108 _Unwind_GetTextRelBase (struct _Unwind_Context *context) 109 { 110 return __libunwind_Unwind_GetTextRelBase (context); 111 } 112 symver (_Unwind_GetTextRelBase, GCC_3.0); 113 #endif 114 115 extern _Unwind_Word __libunwind_Unwind_GetGR 116 (struct _Unwind_Context *, int ); 117 118 _Unwind_Word 119 _Unwind_GetGR (struct _Unwind_Context *context, int index) 120 { 121 return __libunwind_Unwind_GetGR (context, index); 122 } 123 symver (_Unwind_GetGR, GCC_3.0); 124 125 extern _Unwind_Ptr __libunwind_Unwind_GetIP (struct _Unwind_Context *); 126 127 _Unwind_Ptr 128 _Unwind_GetIP (struct _Unwind_Context *context) 129 { 130 return __libunwind_Unwind_GetIP (context); 131 } 132 symver (_Unwind_GetIP, GCC_3.0); 133 134 _Unwind_Ptr 135 _Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn) 136 { 137 *ip_before_insn = 0; 138 return __libunwind_Unwind_GetIP (context); 139 } 140 141 extern void *__libunwind_Unwind_GetLanguageSpecificData 142 (struct _Unwind_Context *); 143 144 void * 145 _Unwind_GetLanguageSpecificData (struct _Unwind_Context *context) 146 { 147 return __libunwind_Unwind_GetLanguageSpecificData (context); 148 } 149 symver (_Unwind_GetLanguageSpecificData, GCC_3.0); 150 151 extern _Unwind_Ptr __libunwind_Unwind_GetRegionStart 152 (struct _Unwind_Context *); 153 154 _Unwind_Ptr 155 _Unwind_GetRegionStart (struct _Unwind_Context *context) 156 { 157 return __libunwind_Unwind_GetRegionStart (context); 158 } 159 symver (_Unwind_GetRegionStart, GCC_3.0); 160 161 extern _Unwind_Reason_Code __libunwind_Unwind_RaiseException 162 (struct _Unwind_Exception *); 163 164 _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE 165 _Unwind_RaiseException(struct _Unwind_Exception *exc) 166 { 167 return __libunwind_Unwind_RaiseException (exc); 168 } 169 symver (_Unwind_RaiseException, GCC_3.0); 170 171 extern void __libunwind_Unwind_Resume (struct _Unwind_Exception *); 172 173 void LIBGCC2_UNWIND_ATTRIBUTE 174 _Unwind_Resume (struct _Unwind_Exception *exc) 175 { 176 __libunwind_Unwind_Resume (exc); 177 } 178 symver (_Unwind_Resume, GCC_3.0); 179 180 extern _Unwind_Reason_Code __libunwind_Unwind_Resume_or_Rethrow 181 (struct _Unwind_Exception *); 182 183 _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE 184 _Unwind_Resume_or_Rethrow (struct _Unwind_Exception *exc) 185 { 186 return __libunwind_Unwind_Resume_or_Rethrow (exc); 187 } 188 symver (_Unwind_Resume_or_Rethrow, GCC_3.3); 189 190 extern void __libunwind_Unwind_SetGR 191 (struct _Unwind_Context *, int, _Unwind_Word); 192 193 void 194 _Unwind_SetGR (struct _Unwind_Context *context, int index, 195 _Unwind_Word val) 196 { 197 __libunwind_Unwind_SetGR (context, index, val); 198 } 199 symver (_Unwind_SetGR, GCC_3.0); 200 201 extern void __libunwind_Unwind_SetIP 202 (struct _Unwind_Context *, _Unwind_Ptr); 203 204 void 205 _Unwind_SetIP (struct _Unwind_Context *context, _Unwind_Ptr val) 206 { 207 return __libunwind_Unwind_SetIP (context, val); 208 } 209 symver (_Unwind_SetIP, GCC_3.0); 210 #endif 211