unwind-compat.c 5.7 KB
Newer Older
1
/* Backward compatibility unwind routines.
2
   Copyright (C) 2004-2020 Free Software Foundation, Inc.
3 4 5 6 7

   This file is part of GCC.

   GCC is free software; you can redistribute it and/or modify it
   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 10 11 12 13 14 15
   any later version.

   GCC is distributed in the hope that it will be useful, but WITHOUT
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
   License for more details.

16 17 18 19 20 21 22 23
   Under Section 7 of GPL version 3, you are granted additional
   permissions described in the GCC Runtime Library Exception, version
   3.1, as published by the Free Software Foundation.

   You should have received a copy of the GNU General Public License and
   a copy of the GCC Runtime Library Exception along with this program;
   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
   <http://www.gnu.org/licenses/>.  */
24 25

#if defined (USE_GAS_SYMVER) && defined (USE_LIBUNWIND_EXCEPTIONS)
26 27
#include "tconfig.h"
#include "tsystem.h"
28 29 30 31 32 33 34
#include "unwind.h"
#include "unwind-dw2-fde.h"
#include "unwind-compat.h"

extern _Unwind_Reason_Code __libunwind_Unwind_Backtrace
  (_Unwind_Trace_Fn, void *);

35
_Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
_Unwind_Backtrace (_Unwind_Trace_Fn trace, void *trace_argument)
{
  return __libunwind_Unwind_Backtrace (trace, trace_argument);
}
symver (_Unwind_Backtrace, GCC_3.3);

extern void __libunwind_Unwind_DeleteException
  (struct _Unwind_Exception *);

void
_Unwind_DeleteException (struct _Unwind_Exception *exc)
{
  return __libunwind_Unwind_DeleteException (exc);
}
symver (_Unwind_DeleteException, GCC_3.0);

extern void * __libunwind_Unwind_FindEnclosingFunction (void *);

void *
_Unwind_FindEnclosingFunction (void *pc)
{
  return __libunwind_Unwind_FindEnclosingFunction (pc);
}
symver (_Unwind_FindEnclosingFunction, GCC_3.3);

extern _Unwind_Reason_Code __libunwind_Unwind_ForcedUnwind
  (struct _Unwind_Exception *, _Unwind_Stop_Fn, void *);

64
_Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
_Unwind_ForcedUnwind (struct _Unwind_Exception *exc,
		      _Unwind_Stop_Fn stop, void * stop_argument)
{
  return __libunwind_Unwind_ForcedUnwind (exc, stop, stop_argument);
}
symver (_Unwind_ForcedUnwind, GCC_3.0);

extern _Unwind_Word __libunwind_Unwind_GetCFA
  (struct _Unwind_Context *);

_Unwind_Word
_Unwind_GetCFA (struct _Unwind_Context *context)
{
  return __libunwind_Unwind_GetCFA (context);
}
symver (_Unwind_GetCFA, GCC_3.3);

#ifdef __ia64__
extern _Unwind_Word __libunwind_Unwind_GetBSP
  (struct _Unwind_Context *);

_Unwind_Word
_Unwind_GetBSP (struct _Unwind_Context * context)
{
  return __libunwind_Unwind_GetBSP (context);
}
symver (_Unwind_GetBSP, GCC_3.3.2);
#else
extern _Unwind_Ptr __libunwind_Unwind_GetDataRelBase
  (struct _Unwind_Context *);

_Unwind_Ptr
_Unwind_GetDataRelBase (struct _Unwind_Context *context)
{
  return __libunwind_Unwind_GetDataRelBase (context);
}
symver (_Unwind_GetDataRelBase, GCC_3.0);

extern _Unwind_Ptr __libunwind_Unwind_GetTextRelBase
  (struct _Unwind_Context *);

_Unwind_Ptr
_Unwind_GetTextRelBase (struct _Unwind_Context *context)
{
  return __libunwind_Unwind_GetTextRelBase (context);
}
symver (_Unwind_GetTextRelBase, GCC_3.0);
#endif

extern _Unwind_Word __libunwind_Unwind_GetGR
  (struct _Unwind_Context *, int );

_Unwind_Word
_Unwind_GetGR (struct _Unwind_Context *context, int index)
{
  return __libunwind_Unwind_GetGR (context, index);
}
symver (_Unwind_GetGR, GCC_3.0);

extern _Unwind_Ptr __libunwind_Unwind_GetIP (struct _Unwind_Context *);

_Unwind_Ptr
_Unwind_GetIP (struct _Unwind_Context *context)
{
  return __libunwind_Unwind_GetIP (context);
}
symver (_Unwind_GetIP, GCC_3.0);

133 134 135 136 137 138 139
_Unwind_Ptr
_Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
{
  *ip_before_insn = 0;
  return __libunwind_Unwind_GetIP (context);
}

140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
extern void *__libunwind_Unwind_GetLanguageSpecificData
  (struct _Unwind_Context *);

void *
_Unwind_GetLanguageSpecificData (struct _Unwind_Context *context)
{
  return __libunwind_Unwind_GetLanguageSpecificData (context);
}
symver (_Unwind_GetLanguageSpecificData, GCC_3.0);

extern _Unwind_Ptr __libunwind_Unwind_GetRegionStart
  (struct _Unwind_Context *);

_Unwind_Ptr
_Unwind_GetRegionStart (struct _Unwind_Context *context)
{
  return __libunwind_Unwind_GetRegionStart (context);
}
symver (_Unwind_GetRegionStart, GCC_3.0);

extern _Unwind_Reason_Code __libunwind_Unwind_RaiseException
  (struct _Unwind_Exception *);

163
_Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE
164 165 166 167 168 169 170 171
_Unwind_RaiseException(struct _Unwind_Exception *exc)
{
  return __libunwind_Unwind_RaiseException (exc);
}
symver (_Unwind_RaiseException, GCC_3.0);

extern void __libunwind_Unwind_Resume (struct _Unwind_Exception *);

172
void LIBGCC2_UNWIND_ATTRIBUTE
173 174 175 176 177 178 179 180 181
_Unwind_Resume (struct _Unwind_Exception *exc)
{
  __libunwind_Unwind_Resume (exc);
}
symver (_Unwind_Resume, GCC_3.0);

extern _Unwind_Reason_Code __libunwind_Unwind_Resume_or_Rethrow
   (struct _Unwind_Exception *);

182
_Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE
183 184 185 186 187 188 189 190 191 192 193
_Unwind_Resume_or_Rethrow (struct _Unwind_Exception *exc)
{
  return __libunwind_Unwind_Resume_or_Rethrow (exc);
}
symver (_Unwind_Resume_or_Rethrow, GCC_3.3);

extern void __libunwind_Unwind_SetGR
  (struct _Unwind_Context *, int, _Unwind_Word);

void
_Unwind_SetGR (struct _Unwind_Context *context, int index,
H.J. Lu committed
194
	       _Unwind_Word val)
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
{
  __libunwind_Unwind_SetGR (context, index, val);
}
symver (_Unwind_SetGR, GCC_3.0);

extern void __libunwind_Unwind_SetIP
  (struct _Unwind_Context *, _Unwind_Ptr);

void
_Unwind_SetIP (struct _Unwind_Context *context, _Unwind_Ptr val)
{
  return __libunwind_Unwind_SetIP (context, val);
}
symver (_Unwind_SetIP, GCC_3.0);
#endif