Home | History | Annotate | Line # | Download | only in libgcc
      1   1.1    mrg /* Backward compatibility unwind routines.
      2  1.10    mrg    Copyright (C) 2004-2024 Free Software Foundation, Inc.
      3   1.1    mrg 
      4   1.1    mrg    This file is part of GCC.
      5   1.1    mrg 
      6   1.1    mrg    GCC is free software; you can redistribute it and/or modify it
      7   1.1    mrg    under the terms of the GNU General Public License as published by
      8   1.1    mrg    the Free Software Foundation; either version 3, or (at your option)
      9   1.1    mrg    any later version.
     10   1.1    mrg 
     11   1.1    mrg    GCC is distributed in the hope that it will be useful, but WITHOUT
     12   1.1    mrg    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
     13   1.1    mrg    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
     14   1.1    mrg    License for more details.
     15   1.1    mrg 
     16   1.1    mrg    Under Section 7 of GPL version 3, you are granted additional
     17   1.1    mrg    permissions described in the GCC Runtime Library Exception, version
     18   1.1    mrg    3.1, as published by the Free Software Foundation.
     19   1.1    mrg 
     20   1.1    mrg    You should have received a copy of the GNU General Public License and
     21   1.1    mrg    a copy of the GCC Runtime Library Exception along with this program;
     22   1.1    mrg    see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
     23   1.1    mrg    <http://www.gnu.org/licenses/>.  */
     24   1.1    mrg 
     25   1.1    mrg #if defined (USE_GAS_SYMVER) && defined (USE_LIBUNWIND_EXCEPTIONS)
     26   1.1    mrg #include "tconfig.h"
     27   1.1    mrg #include "tsystem.h"
     28   1.1    mrg #include "unwind.h"
     29   1.1    mrg #include "unwind-dw2-fde.h"
     30   1.1    mrg #include "unwind-compat.h"
     31   1.1    mrg 
     32   1.1    mrg extern _Unwind_Reason_Code __libunwind_Unwind_Backtrace
     33   1.1    mrg   (_Unwind_Trace_Fn, void *);
     34   1.1    mrg 
     35   1.1    mrg _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE
     36   1.1    mrg _Unwind_Backtrace (_Unwind_Trace_Fn trace, void *trace_argument)
     37   1.1    mrg {
     38   1.1    mrg   return __libunwind_Unwind_Backtrace (trace, trace_argument);
     39   1.1    mrg }
     40   1.1    mrg symver (_Unwind_Backtrace, GCC_3.3);
     41   1.1    mrg 
     42   1.1    mrg extern void __libunwind_Unwind_DeleteException
     43   1.1    mrg   (struct _Unwind_Exception *);
     44   1.1    mrg 
     45   1.1    mrg void
     46   1.1    mrg _Unwind_DeleteException (struct _Unwind_Exception *exc)
     47   1.1    mrg {
     48   1.1    mrg   return __libunwind_Unwind_DeleteException (exc);
     49   1.1    mrg }
     50   1.1    mrg symver (_Unwind_DeleteException, GCC_3.0);
     51   1.1    mrg 
     52   1.1    mrg extern void * __libunwind_Unwind_FindEnclosingFunction (void *);
     53   1.1    mrg 
     54   1.1    mrg void *
     55   1.1    mrg _Unwind_FindEnclosingFunction (void *pc)
     56   1.1    mrg {
     57   1.1    mrg   return __libunwind_Unwind_FindEnclosingFunction (pc);
     58   1.1    mrg }
     59   1.1    mrg symver (_Unwind_FindEnclosingFunction, GCC_3.3);
     60   1.1    mrg 
     61   1.1    mrg extern _Unwind_Reason_Code __libunwind_Unwind_ForcedUnwind
     62   1.1    mrg   (struct _Unwind_Exception *, _Unwind_Stop_Fn, void *);
     63   1.1    mrg 
     64   1.1    mrg _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE
     65   1.1    mrg _Unwind_ForcedUnwind (struct _Unwind_Exception *exc,
     66   1.1    mrg 		      _Unwind_Stop_Fn stop, void * stop_argument)
     67   1.1    mrg {
     68   1.1    mrg   return __libunwind_Unwind_ForcedUnwind (exc, stop, stop_argument);
     69   1.1    mrg }
     70   1.1    mrg symver (_Unwind_ForcedUnwind, GCC_3.0);
     71   1.1    mrg 
     72   1.1    mrg extern _Unwind_Word __libunwind_Unwind_GetCFA
     73   1.1    mrg   (struct _Unwind_Context *);
     74   1.1    mrg 
     75   1.1    mrg _Unwind_Word
     76   1.1    mrg _Unwind_GetCFA (struct _Unwind_Context *context)
     77   1.1    mrg {
     78   1.1    mrg   return __libunwind_Unwind_GetCFA (context);
     79   1.1    mrg }
     80   1.1    mrg symver (_Unwind_GetCFA, GCC_3.3);
     81   1.1    mrg 
     82   1.1    mrg #ifdef __ia64__
     83   1.1    mrg extern _Unwind_Word __libunwind_Unwind_GetBSP
     84   1.1    mrg   (struct _Unwind_Context *);
     85   1.1    mrg 
     86   1.1    mrg _Unwind_Word
     87   1.1    mrg _Unwind_GetBSP (struct _Unwind_Context * context)
     88   1.1    mrg {
     89   1.1    mrg   return __libunwind_Unwind_GetBSP (context);
     90   1.1    mrg }
     91   1.1    mrg symver (_Unwind_GetBSP, GCC_3.3.2);
     92   1.1    mrg #else
     93   1.1    mrg extern _Unwind_Ptr __libunwind_Unwind_GetDataRelBase
     94   1.1    mrg   (struct _Unwind_Context *);
     95   1.1    mrg 
     96   1.1    mrg _Unwind_Ptr
     97   1.1    mrg _Unwind_GetDataRelBase (struct _Unwind_Context *context)
     98   1.1    mrg {
     99   1.1    mrg   return __libunwind_Unwind_GetDataRelBase (context);
    100   1.1    mrg }
    101   1.1    mrg symver (_Unwind_GetDataRelBase, GCC_3.0);
    102   1.1    mrg 
    103   1.1    mrg extern _Unwind_Ptr __libunwind_Unwind_GetTextRelBase
    104   1.1    mrg   (struct _Unwind_Context *);
    105   1.1    mrg 
    106   1.1    mrg _Unwind_Ptr
    107   1.1    mrg _Unwind_GetTextRelBase (struct _Unwind_Context *context)
    108   1.1    mrg {
    109   1.1    mrg   return __libunwind_Unwind_GetTextRelBase (context);
    110   1.1    mrg }
    111   1.1    mrg symver (_Unwind_GetTextRelBase, GCC_3.0);
    112   1.1    mrg #endif
    113   1.1    mrg 
    114   1.1    mrg extern _Unwind_Word __libunwind_Unwind_GetGR
    115   1.1    mrg   (struct _Unwind_Context *, int );
    116   1.1    mrg 
    117   1.1    mrg _Unwind_Word
    118   1.1    mrg _Unwind_GetGR (struct _Unwind_Context *context, int index)
    119   1.1    mrg {
    120   1.1    mrg   return __libunwind_Unwind_GetGR (context, index);
    121   1.1    mrg }
    122   1.1    mrg symver (_Unwind_GetGR, GCC_3.0);
    123   1.1    mrg 
    124   1.1    mrg extern _Unwind_Ptr __libunwind_Unwind_GetIP (struct _Unwind_Context *);
    125   1.1    mrg 
    126   1.1    mrg _Unwind_Ptr
    127   1.1    mrg _Unwind_GetIP (struct _Unwind_Context *context)
    128   1.1    mrg {
    129   1.1    mrg   return __libunwind_Unwind_GetIP (context);
    130   1.1    mrg }
    131   1.1    mrg symver (_Unwind_GetIP, GCC_3.0);
    132   1.1    mrg 
    133   1.1    mrg _Unwind_Ptr
    134   1.1    mrg _Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
    135   1.1    mrg {
    136   1.1    mrg   *ip_before_insn = 0;
    137   1.1    mrg   return __libunwind_Unwind_GetIP (context);
    138   1.1    mrg }
    139   1.1    mrg 
    140   1.2  joerg extern _Unwind_Ptr __libunwind_Unwind_GetLanguageSpecificData
    141   1.1    mrg   (struct _Unwind_Context *);
    142   1.1    mrg 
    143   1.2  joerg _Unwind_Ptr
    144   1.1    mrg _Unwind_GetLanguageSpecificData (struct _Unwind_Context *context)
    145   1.1    mrg {
    146   1.1    mrg   return __libunwind_Unwind_GetLanguageSpecificData (context);
    147   1.1    mrg }
    148   1.1    mrg symver (_Unwind_GetLanguageSpecificData, GCC_3.0);
    149   1.1    mrg 
    150   1.1    mrg extern _Unwind_Ptr __libunwind_Unwind_GetRegionStart
    151   1.1    mrg   (struct _Unwind_Context *);
    152   1.1    mrg 
    153   1.1    mrg _Unwind_Ptr
    154   1.1    mrg _Unwind_GetRegionStart (struct _Unwind_Context *context)
    155   1.1    mrg {
    156   1.1    mrg   return __libunwind_Unwind_GetRegionStart (context);
    157   1.1    mrg }
    158   1.1    mrg symver (_Unwind_GetRegionStart, GCC_3.0);
    159   1.1    mrg 
    160   1.1    mrg extern _Unwind_Reason_Code __libunwind_Unwind_RaiseException
    161   1.1    mrg   (struct _Unwind_Exception *);
    162   1.1    mrg 
    163   1.1    mrg _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE
    164   1.1    mrg _Unwind_RaiseException(struct _Unwind_Exception *exc)
    165   1.1    mrg {
    166   1.1    mrg   return __libunwind_Unwind_RaiseException (exc);
    167   1.1    mrg }
    168   1.1    mrg symver (_Unwind_RaiseException, GCC_3.0);
    169   1.1    mrg 
    170   1.1    mrg extern void __libunwind_Unwind_Resume (struct _Unwind_Exception *);
    171   1.1    mrg 
    172   1.1    mrg void LIBGCC2_UNWIND_ATTRIBUTE
    173   1.1    mrg _Unwind_Resume (struct _Unwind_Exception *exc)
    174   1.1    mrg {
    175   1.1    mrg   __libunwind_Unwind_Resume (exc);
    176   1.1    mrg }
    177   1.1    mrg symver (_Unwind_Resume, GCC_3.0);
    178   1.1    mrg 
    179   1.1    mrg extern _Unwind_Reason_Code __libunwind_Unwind_Resume_or_Rethrow
    180   1.1    mrg    (struct _Unwind_Exception *);
    181   1.1    mrg 
    182   1.1    mrg _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE
    183   1.1    mrg _Unwind_Resume_or_Rethrow (struct _Unwind_Exception *exc)
    184   1.1    mrg {
    185   1.1    mrg   return __libunwind_Unwind_Resume_or_Rethrow (exc);
    186   1.1    mrg }
    187   1.1    mrg symver (_Unwind_Resume_or_Rethrow, GCC_3.3);
    188   1.1    mrg 
    189   1.1    mrg extern void __libunwind_Unwind_SetGR
    190   1.1    mrg   (struct _Unwind_Context *, int, _Unwind_Word);
    191   1.1    mrg 
    192   1.1    mrg void
    193   1.1    mrg _Unwind_SetGR (struct _Unwind_Context *context, int index,
    194   1.1    mrg 	       _Unwind_Word val)
    195   1.1    mrg {
    196   1.1    mrg   __libunwind_Unwind_SetGR (context, index, val);
    197   1.1    mrg }
    198   1.1    mrg symver (_Unwind_SetGR, GCC_3.0);
    199   1.1    mrg 
    200   1.1    mrg extern void __libunwind_Unwind_SetIP
    201   1.1    mrg   (struct _Unwind_Context *, _Unwind_Ptr);
    202   1.1    mrg 
    203   1.1    mrg void
    204   1.1    mrg _Unwind_SetIP (struct _Unwind_Context *context, _Unwind_Ptr val)
    205   1.1    mrg {
    206   1.1    mrg   return __libunwind_Unwind_SetIP (context, val);
    207   1.1    mrg }
    208   1.1    mrg symver (_Unwind_SetIP, GCC_3.0);
    209   1.1    mrg #endif
    210