1 /* Backward compatibility unwind routines. 2 Copyright (C) 2004-2019 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 32 extern _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 } 40 symver (_Unwind_Backtrace, GCC_3.3); 41 42 extern void __libunwind_Unwind_DeleteException 43 (struct _Unwind_Exception *); 44 45 void 46 _Unwind_DeleteException (struct _Unwind_Exception *exc) 47 { 48 return __libunwind_Unwind_DeleteException (exc); 49 } 50 symver (_Unwind_DeleteException, GCC_3.0); 51 52 extern void * __libunwind_Unwind_FindEnclosingFunction (void *); 53 54 void * 55 _Unwind_FindEnclosingFunction (void *pc) 56 { 57 return __libunwind_Unwind_FindEnclosingFunction (pc); 58 } 59 symver (_Unwind_FindEnclosingFunction, GCC_3.3); 60 61 extern _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 } 70 symver (_Unwind_ForcedUnwind, GCC_3.0); 71 72 extern _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 } 80 symver (_Unwind_GetCFA, GCC_3.3); 81 82 #ifdef __ia64__ 83 extern _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 } 91 symver (_Unwind_GetBSP, GCC_3.3.2); 92 #else 93 extern _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 } 101 symver (_Unwind_GetDataRelBase, GCC_3.0); 102 103 extern _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 } 111 symver (_Unwind_GetTextRelBase, GCC_3.0); 112 #endif 113 114 extern _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 } 122 symver (_Unwind_GetGR, GCC_3.0); 123 124 extern _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 } 131 symver (_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 140 extern _Unwind_Ptr __libunwind_Unwind_GetLanguageSpecificData 141 (struct _Unwind_Context *); 142 143 _Unwind_Ptr 144 _Unwind_GetLanguageSpecificData (struct _Unwind_Context *context) 145 { 146 return __libunwind_Unwind_GetLanguageSpecificData (context); 147 } 148 symver (_Unwind_GetLanguageSpecificData, GCC_3.0); 149 150 extern _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 } 158 symver (_Unwind_GetRegionStart, GCC_3.0); 159 160 extern _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 } 168 symver (_Unwind_RaiseException, GCC_3.0); 169 170 extern void __libunwind_Unwind_Resume (struct _Unwind_Exception *); 171 172 void LIBGCC2_UNWIND_ATTRIBUTE 173 _Unwind_Resume (struct _Unwind_Exception *exc) 174 { 175 __libunwind_Unwind_Resume (exc); 176 } 177 symver (_Unwind_Resume, GCC_3.0); 178 179 extern _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 } 187 symver (_Unwind_Resume_or_Rethrow, GCC_3.3); 188 189 extern void __libunwind_Unwind_SetGR 190 (struct _Unwind_Context *, int, _Unwind_Word); 191 192 void 193 _Unwind_SetGR (struct _Unwind_Context *context, int index, 194 _Unwind_Word val) 195 { 196 __libunwind_Unwind_SetGR (context, index, val); 197 } 198 symver (_Unwind_SetGR, GCC_3.0); 199 200 extern void __libunwind_Unwind_SetIP 201 (struct _Unwind_Context *, _Unwind_Ptr); 202 203 void 204 _Unwind_SetIP (struct _Unwind_Context *context, _Unwind_Ptr val) 205 { 206 return __libunwind_Unwind_SetIP (context, val); 207 } 208 symver (_Unwind_SetIP, GCC_3.0); 209 #endif 210