xref: /netbsd-src/external/gpl3/gcc.old/dist/libgcc/unwind-compat.c (revision 8feb0f0b7eaff0608f8350bbfa3098827b4bb91b)
11debfc3dSmrg /* Backward compatibility unwind routines.
2*8feb0f0bSmrg    Copyright (C) 2004-2020 Free Software Foundation, Inc.
31debfc3dSmrg 
41debfc3dSmrg    This file is part of GCC.
51debfc3dSmrg 
61debfc3dSmrg    GCC is free software; you can redistribute it and/or modify it
71debfc3dSmrg    under the terms of the GNU General Public License as published by
81debfc3dSmrg    the Free Software Foundation; either version 3, or (at your option)
91debfc3dSmrg    any later version.
101debfc3dSmrg 
111debfc3dSmrg    GCC is distributed in the hope that it will be useful, but WITHOUT
121debfc3dSmrg    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
131debfc3dSmrg    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
141debfc3dSmrg    License for more details.
151debfc3dSmrg 
161debfc3dSmrg    Under Section 7 of GPL version 3, you are granted additional
171debfc3dSmrg    permissions described in the GCC Runtime Library Exception, version
181debfc3dSmrg    3.1, as published by the Free Software Foundation.
191debfc3dSmrg 
201debfc3dSmrg    You should have received a copy of the GNU General Public License and
211debfc3dSmrg    a copy of the GCC Runtime Library Exception along with this program;
221debfc3dSmrg    see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
231debfc3dSmrg    <http://www.gnu.org/licenses/>.  */
241debfc3dSmrg 
251debfc3dSmrg #if defined (USE_GAS_SYMVER) && defined (USE_LIBUNWIND_EXCEPTIONS)
261debfc3dSmrg #include "tconfig.h"
271debfc3dSmrg #include "tsystem.h"
281debfc3dSmrg #include "unwind.h"
291debfc3dSmrg #include "unwind-dw2-fde.h"
301debfc3dSmrg #include "unwind-compat.h"
311debfc3dSmrg 
321debfc3dSmrg extern _Unwind_Reason_Code __libunwind_Unwind_Backtrace
331debfc3dSmrg   (_Unwind_Trace_Fn, void *);
341debfc3dSmrg 
351debfc3dSmrg _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE
_Unwind_Backtrace(_Unwind_Trace_Fn trace,void * trace_argument)361debfc3dSmrg _Unwind_Backtrace (_Unwind_Trace_Fn trace, void *trace_argument)
371debfc3dSmrg {
381debfc3dSmrg   return __libunwind_Unwind_Backtrace (trace, trace_argument);
391debfc3dSmrg }
401debfc3dSmrg symver (_Unwind_Backtrace, GCC_3.3);
411debfc3dSmrg 
421debfc3dSmrg extern void __libunwind_Unwind_DeleteException
431debfc3dSmrg   (struct _Unwind_Exception *);
441debfc3dSmrg 
451debfc3dSmrg void
_Unwind_DeleteException(struct _Unwind_Exception * exc)461debfc3dSmrg _Unwind_DeleteException (struct _Unwind_Exception *exc)
471debfc3dSmrg {
481debfc3dSmrg   return __libunwind_Unwind_DeleteException (exc);
491debfc3dSmrg }
501debfc3dSmrg symver (_Unwind_DeleteException, GCC_3.0);
511debfc3dSmrg 
521debfc3dSmrg extern void * __libunwind_Unwind_FindEnclosingFunction (void *);
531debfc3dSmrg 
541debfc3dSmrg void *
_Unwind_FindEnclosingFunction(void * pc)551debfc3dSmrg _Unwind_FindEnclosingFunction (void *pc)
561debfc3dSmrg {
571debfc3dSmrg   return __libunwind_Unwind_FindEnclosingFunction (pc);
581debfc3dSmrg }
591debfc3dSmrg symver (_Unwind_FindEnclosingFunction, GCC_3.3);
601debfc3dSmrg 
611debfc3dSmrg extern _Unwind_Reason_Code __libunwind_Unwind_ForcedUnwind
621debfc3dSmrg   (struct _Unwind_Exception *, _Unwind_Stop_Fn, void *);
631debfc3dSmrg 
641debfc3dSmrg _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE
_Unwind_ForcedUnwind(struct _Unwind_Exception * exc,_Unwind_Stop_Fn stop,void * stop_argument)651debfc3dSmrg _Unwind_ForcedUnwind (struct _Unwind_Exception *exc,
661debfc3dSmrg 		      _Unwind_Stop_Fn stop, void * stop_argument)
671debfc3dSmrg {
681debfc3dSmrg   return __libunwind_Unwind_ForcedUnwind (exc, stop, stop_argument);
691debfc3dSmrg }
701debfc3dSmrg symver (_Unwind_ForcedUnwind, GCC_3.0);
711debfc3dSmrg 
721debfc3dSmrg extern _Unwind_Word __libunwind_Unwind_GetCFA
731debfc3dSmrg   (struct _Unwind_Context *);
741debfc3dSmrg 
751debfc3dSmrg _Unwind_Word
_Unwind_GetCFA(struct _Unwind_Context * context)761debfc3dSmrg _Unwind_GetCFA (struct _Unwind_Context *context)
771debfc3dSmrg {
781debfc3dSmrg   return __libunwind_Unwind_GetCFA (context);
791debfc3dSmrg }
801debfc3dSmrg symver (_Unwind_GetCFA, GCC_3.3);
811debfc3dSmrg 
821debfc3dSmrg #ifdef __ia64__
831debfc3dSmrg extern _Unwind_Word __libunwind_Unwind_GetBSP
841debfc3dSmrg   (struct _Unwind_Context *);
851debfc3dSmrg 
861debfc3dSmrg _Unwind_Word
_Unwind_GetBSP(struct _Unwind_Context * context)871debfc3dSmrg _Unwind_GetBSP (struct _Unwind_Context * context)
881debfc3dSmrg {
891debfc3dSmrg   return __libunwind_Unwind_GetBSP (context);
901debfc3dSmrg }
911debfc3dSmrg symver (_Unwind_GetBSP, GCC_3.3.2);
921debfc3dSmrg #else
931debfc3dSmrg extern _Unwind_Ptr __libunwind_Unwind_GetDataRelBase
941debfc3dSmrg   (struct _Unwind_Context *);
951debfc3dSmrg 
961debfc3dSmrg _Unwind_Ptr
_Unwind_GetDataRelBase(struct _Unwind_Context * context)971debfc3dSmrg _Unwind_GetDataRelBase (struct _Unwind_Context *context)
981debfc3dSmrg {
991debfc3dSmrg   return __libunwind_Unwind_GetDataRelBase (context);
1001debfc3dSmrg }
1011debfc3dSmrg symver (_Unwind_GetDataRelBase, GCC_3.0);
1021debfc3dSmrg 
1031debfc3dSmrg extern _Unwind_Ptr __libunwind_Unwind_GetTextRelBase
1041debfc3dSmrg   (struct _Unwind_Context *);
1051debfc3dSmrg 
1061debfc3dSmrg _Unwind_Ptr
_Unwind_GetTextRelBase(struct _Unwind_Context * context)1071debfc3dSmrg _Unwind_GetTextRelBase (struct _Unwind_Context *context)
1081debfc3dSmrg {
1091debfc3dSmrg   return __libunwind_Unwind_GetTextRelBase (context);
1101debfc3dSmrg }
1111debfc3dSmrg symver (_Unwind_GetTextRelBase, GCC_3.0);
1121debfc3dSmrg #endif
1131debfc3dSmrg 
1141debfc3dSmrg extern _Unwind_Word __libunwind_Unwind_GetGR
1151debfc3dSmrg   (struct _Unwind_Context *, int );
1161debfc3dSmrg 
1171debfc3dSmrg _Unwind_Word
_Unwind_GetGR(struct _Unwind_Context * context,int index)1181debfc3dSmrg _Unwind_GetGR (struct _Unwind_Context *context, int index)
1191debfc3dSmrg {
1201debfc3dSmrg   return __libunwind_Unwind_GetGR (context, index);
1211debfc3dSmrg }
1221debfc3dSmrg symver (_Unwind_GetGR, GCC_3.0);
1231debfc3dSmrg 
1241debfc3dSmrg extern _Unwind_Ptr __libunwind_Unwind_GetIP (struct _Unwind_Context *);
1251debfc3dSmrg 
1261debfc3dSmrg _Unwind_Ptr
_Unwind_GetIP(struct _Unwind_Context * context)1271debfc3dSmrg _Unwind_GetIP (struct _Unwind_Context *context)
1281debfc3dSmrg {
1291debfc3dSmrg   return __libunwind_Unwind_GetIP (context);
1301debfc3dSmrg }
1311debfc3dSmrg symver (_Unwind_GetIP, GCC_3.0);
1321debfc3dSmrg 
1331debfc3dSmrg _Unwind_Ptr
_Unwind_GetIPInfo(struct _Unwind_Context * context,int * ip_before_insn)1341debfc3dSmrg _Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
1351debfc3dSmrg {
1361debfc3dSmrg   *ip_before_insn = 0;
1371debfc3dSmrg   return __libunwind_Unwind_GetIP (context);
1381debfc3dSmrg }
1391debfc3dSmrg 
1401debfc3dSmrg extern _Unwind_Ptr __libunwind_Unwind_GetLanguageSpecificData
1411debfc3dSmrg   (struct _Unwind_Context *);
1421debfc3dSmrg 
1431debfc3dSmrg _Unwind_Ptr
_Unwind_GetLanguageSpecificData(struct _Unwind_Context * context)1441debfc3dSmrg _Unwind_GetLanguageSpecificData (struct _Unwind_Context *context)
1451debfc3dSmrg {
1461debfc3dSmrg   return __libunwind_Unwind_GetLanguageSpecificData (context);
1471debfc3dSmrg }
1481debfc3dSmrg symver (_Unwind_GetLanguageSpecificData, GCC_3.0);
1491debfc3dSmrg 
1501debfc3dSmrg extern _Unwind_Ptr __libunwind_Unwind_GetRegionStart
1511debfc3dSmrg   (struct _Unwind_Context *);
1521debfc3dSmrg 
1531debfc3dSmrg _Unwind_Ptr
_Unwind_GetRegionStart(struct _Unwind_Context * context)1541debfc3dSmrg _Unwind_GetRegionStart (struct _Unwind_Context *context)
1551debfc3dSmrg {
1561debfc3dSmrg   return __libunwind_Unwind_GetRegionStart (context);
1571debfc3dSmrg }
1581debfc3dSmrg symver (_Unwind_GetRegionStart, GCC_3.0);
1591debfc3dSmrg 
1601debfc3dSmrg extern _Unwind_Reason_Code __libunwind_Unwind_RaiseException
1611debfc3dSmrg   (struct _Unwind_Exception *);
1621debfc3dSmrg 
1631debfc3dSmrg _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE
_Unwind_RaiseException(struct _Unwind_Exception * exc)1641debfc3dSmrg _Unwind_RaiseException(struct _Unwind_Exception *exc)
1651debfc3dSmrg {
1661debfc3dSmrg   return __libunwind_Unwind_RaiseException (exc);
1671debfc3dSmrg }
1681debfc3dSmrg symver (_Unwind_RaiseException, GCC_3.0);
1691debfc3dSmrg 
1701debfc3dSmrg extern void __libunwind_Unwind_Resume (struct _Unwind_Exception *);
1711debfc3dSmrg 
1721debfc3dSmrg void LIBGCC2_UNWIND_ATTRIBUTE
_Unwind_Resume(struct _Unwind_Exception * exc)1731debfc3dSmrg _Unwind_Resume (struct _Unwind_Exception *exc)
1741debfc3dSmrg {
1751debfc3dSmrg   __libunwind_Unwind_Resume (exc);
1761debfc3dSmrg }
1771debfc3dSmrg symver (_Unwind_Resume, GCC_3.0);
1781debfc3dSmrg 
1791debfc3dSmrg extern _Unwind_Reason_Code __libunwind_Unwind_Resume_or_Rethrow
1801debfc3dSmrg    (struct _Unwind_Exception *);
1811debfc3dSmrg 
1821debfc3dSmrg _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE
_Unwind_Resume_or_Rethrow(struct _Unwind_Exception * exc)1831debfc3dSmrg _Unwind_Resume_or_Rethrow (struct _Unwind_Exception *exc)
1841debfc3dSmrg {
1851debfc3dSmrg   return __libunwind_Unwind_Resume_or_Rethrow (exc);
1861debfc3dSmrg }
1871debfc3dSmrg symver (_Unwind_Resume_or_Rethrow, GCC_3.3);
1881debfc3dSmrg 
1891debfc3dSmrg extern void __libunwind_Unwind_SetGR
1901debfc3dSmrg   (struct _Unwind_Context *, int, _Unwind_Word);
1911debfc3dSmrg 
1921debfc3dSmrg void
_Unwind_SetGR(struct _Unwind_Context * context,int index,_Unwind_Word val)1931debfc3dSmrg _Unwind_SetGR (struct _Unwind_Context *context, int index,
1941debfc3dSmrg 	       _Unwind_Word val)
1951debfc3dSmrg {
1961debfc3dSmrg   __libunwind_Unwind_SetGR (context, index, val);
1971debfc3dSmrg }
1981debfc3dSmrg symver (_Unwind_SetGR, GCC_3.0);
1991debfc3dSmrg 
2001debfc3dSmrg extern void __libunwind_Unwind_SetIP
2011debfc3dSmrg   (struct _Unwind_Context *, _Unwind_Ptr);
2021debfc3dSmrg 
2031debfc3dSmrg void
_Unwind_SetIP(struct _Unwind_Context * context,_Unwind_Ptr val)2041debfc3dSmrg _Unwind_SetIP (struct _Unwind_Context *context, _Unwind_Ptr val)
2051debfc3dSmrg {
2061debfc3dSmrg   return __libunwind_Unwind_SetIP (context, val);
2071debfc3dSmrg }
2081debfc3dSmrg symver (_Unwind_SetIP, GCC_3.0);
2091debfc3dSmrg #endif
210