xref: /dflybsd-src/contrib/gcc-8.0/libstdc++-v3/libsupc++/eh_personality.cc (revision 38fd149817dfbff97799f62fcb70be98c4e32523)
1*38fd1498Szrj // -*- C++ -*- The GNU C++ exception personality routine.
2*38fd1498Szrj // Copyright (C) 2001-2018 Free Software Foundation, Inc.
3*38fd1498Szrj //
4*38fd1498Szrj // This file is part of GCC.
5*38fd1498Szrj //
6*38fd1498Szrj // GCC is free software; you can redistribute it and/or modify
7*38fd1498Szrj // it under the terms of the GNU General Public License as published by
8*38fd1498Szrj // the Free Software Foundation; either version 3, or (at your option)
9*38fd1498Szrj // any later version.
10*38fd1498Szrj //
11*38fd1498Szrj // GCC is distributed in the hope that it will be useful,
12*38fd1498Szrj // but WITHOUT ANY WARRANTY; without even the implied warranty of
13*38fd1498Szrj // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14*38fd1498Szrj // GNU General Public License for more details.
15*38fd1498Szrj //
16*38fd1498Szrj // Under Section 7 of GPL version 3, you are granted additional
17*38fd1498Szrj // permissions described in the GCC Runtime Library Exception, version
18*38fd1498Szrj // 3.1, as published by the Free Software Foundation.
19*38fd1498Szrj 
20*38fd1498Szrj // You should have received a copy of the GNU General Public License and
21*38fd1498Szrj // a copy of the GCC Runtime Library Exception along with this program;
22*38fd1498Szrj // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
23*38fd1498Szrj // <http://www.gnu.org/licenses/>.
24*38fd1498Szrj 
25*38fd1498Szrj #include <bits/c++config.h>
26*38fd1498Szrj #include <cstdlib>
27*38fd1498Szrj #include <bits/exception_defines.h>
28*38fd1498Szrj #include <cxxabi.h>
29*38fd1498Szrj #include "unwind-cxx.h"
30*38fd1498Szrj 
31*38fd1498Szrj 
32*38fd1498Szrj using namespace __cxxabiv1;
33*38fd1498Szrj 
34*38fd1498Szrj #include "unwind-pe.h"
35*38fd1498Szrj 
36*38fd1498Szrj 
37*38fd1498Szrj struct lsda_header_info
38*38fd1498Szrj {
39*38fd1498Szrj   _Unwind_Ptr Start;
40*38fd1498Szrj   _Unwind_Ptr LPStart;
41*38fd1498Szrj   _Unwind_Ptr ttype_base;
42*38fd1498Szrj   const unsigned char *TType;
43*38fd1498Szrj   const unsigned char *action_table;
44*38fd1498Szrj   unsigned char ttype_encoding;
45*38fd1498Szrj   unsigned char call_site_encoding;
46*38fd1498Szrj };
47*38fd1498Szrj 
48*38fd1498Szrj static const unsigned char *
parse_lsda_header(_Unwind_Context * context,const unsigned char * p,lsda_header_info * info)49*38fd1498Szrj parse_lsda_header (_Unwind_Context *context, const unsigned char *p,
50*38fd1498Szrj 		   lsda_header_info *info)
51*38fd1498Szrj {
52*38fd1498Szrj   _uleb128_t tmp;
53*38fd1498Szrj   unsigned char lpstart_encoding;
54*38fd1498Szrj 
55*38fd1498Szrj   info->Start = (context ? _Unwind_GetRegionStart (context) : 0);
56*38fd1498Szrj 
57*38fd1498Szrj   // Find @LPStart, the base to which landing pad offsets are relative.
58*38fd1498Szrj   lpstart_encoding = *p++;
59*38fd1498Szrj   if (lpstart_encoding != DW_EH_PE_omit)
60*38fd1498Szrj     p = read_encoded_value (context, lpstart_encoding, p, &info->LPStart);
61*38fd1498Szrj   else
62*38fd1498Szrj     info->LPStart = info->Start;
63*38fd1498Szrj 
64*38fd1498Szrj   // Find @TType, the base of the handler and exception spec type data.
65*38fd1498Szrj   info->ttype_encoding = *p++;
66*38fd1498Szrj   if (info->ttype_encoding != DW_EH_PE_omit)
67*38fd1498Szrj     {
68*38fd1498Szrj #if _GLIBCXX_OVERRIDE_TTYPE_ENCODING
69*38fd1498Szrj       /* Older ARM EABI toolchains set this value incorrectly, so use a
70*38fd1498Szrj 	 hardcoded OS-specific format.  */
71*38fd1498Szrj       info->ttype_encoding = _GLIBCXX_OVERRIDE_TTYPE_ENCODING;
72*38fd1498Szrj #endif
73*38fd1498Szrj       p = read_uleb128 (p, &tmp);
74*38fd1498Szrj       info->TType = p + tmp;
75*38fd1498Szrj     }
76*38fd1498Szrj   else
77*38fd1498Szrj     info->TType = 0;
78*38fd1498Szrj 
79*38fd1498Szrj   // The encoding and length of the call-site table; the action table
80*38fd1498Szrj   // immediately follows.
81*38fd1498Szrj   info->call_site_encoding = *p++;
82*38fd1498Szrj   p = read_uleb128 (p, &tmp);
83*38fd1498Szrj   info->action_table = p + tmp;
84*38fd1498Szrj 
85*38fd1498Szrj   return p;
86*38fd1498Szrj }
87*38fd1498Szrj 
88*38fd1498Szrj // Return an element from a type table.
89*38fd1498Szrj 
90*38fd1498Szrj static const std::type_info *
get_ttype_entry(lsda_header_info * info,_uleb128_t i)91*38fd1498Szrj get_ttype_entry (lsda_header_info *info, _uleb128_t i)
92*38fd1498Szrj {
93*38fd1498Szrj   _Unwind_Ptr ptr;
94*38fd1498Szrj 
95*38fd1498Szrj   i *= size_of_encoded_value (info->ttype_encoding);
96*38fd1498Szrj   read_encoded_value_with_base (info->ttype_encoding, info->ttype_base,
97*38fd1498Szrj 				info->TType - i, &ptr);
98*38fd1498Szrj 
99*38fd1498Szrj   return reinterpret_cast<const std::type_info *>(ptr);
100*38fd1498Szrj }
101*38fd1498Szrj 
102*38fd1498Szrj #ifdef __ARM_EABI_UNWINDER__
103*38fd1498Szrj 
104*38fd1498Szrj // The ABI provides a routine for matching exception object types.
105*38fd1498Szrj typedef _Unwind_Control_Block _throw_typet;
106*38fd1498Szrj #define get_adjusted_ptr(catch_type, throw_type, thrown_ptr_p) \
107*38fd1498Szrj   (__cxa_type_match (throw_type, catch_type, false, thrown_ptr_p) \
108*38fd1498Szrj    != ctm_failed)
109*38fd1498Szrj 
110*38fd1498Szrj // Return true if THROW_TYPE matches one if the filter types.
111*38fd1498Szrj 
112*38fd1498Szrj static bool
check_exception_spec(lsda_header_info * info,_throw_typet * throw_type,void * thrown_ptr,_sleb128_t filter_value)113*38fd1498Szrj check_exception_spec(lsda_header_info* info, _throw_typet* throw_type,
114*38fd1498Szrj 		     void* thrown_ptr, _sleb128_t filter_value)
115*38fd1498Szrj {
116*38fd1498Szrj   const _uleb128_t* e = ((const _uleb128_t*) info->TType)
117*38fd1498Szrj 			  - filter_value - 1;
118*38fd1498Szrj 
119*38fd1498Szrj   while (1)
120*38fd1498Szrj     {
121*38fd1498Szrj       const std::type_info* catch_type;
122*38fd1498Szrj       _uleb128_t tmp;
123*38fd1498Szrj 
124*38fd1498Szrj       tmp = *e;
125*38fd1498Szrj 
126*38fd1498Szrj       // Zero signals the end of the list.  If we've not found
127*38fd1498Szrj       // a match by now, then we've failed the specification.
128*38fd1498Szrj       if (tmp == 0)
129*38fd1498Szrj         return false;
130*38fd1498Szrj 
131*38fd1498Szrj       tmp = _Unwind_decode_typeinfo_ptr(info->ttype_base, (_Unwind_Word) e);
132*38fd1498Szrj 
133*38fd1498Szrj       // Match a ttype entry.
134*38fd1498Szrj       catch_type = reinterpret_cast<const std::type_info*>(tmp);
135*38fd1498Szrj 
136*38fd1498Szrj       // ??? There is currently no way to ask the RTTI code about the
137*38fd1498Szrj       // relationship between two types without reference to a specific
138*38fd1498Szrj       // object.  There should be; then we wouldn't need to mess with
139*38fd1498Szrj       // thrown_ptr here.
140*38fd1498Szrj       if (get_adjusted_ptr(catch_type, throw_type, &thrown_ptr))
141*38fd1498Szrj 	return true;
142*38fd1498Szrj 
143*38fd1498Szrj       // Advance to the next entry.
144*38fd1498Szrj       e++;
145*38fd1498Szrj     }
146*38fd1498Szrj }
147*38fd1498Szrj 
148*38fd1498Szrj 
149*38fd1498Szrj // Save stage1 handler information in the exception object
150*38fd1498Szrj 
151*38fd1498Szrj static inline void
save_caught_exception(struct _Unwind_Exception * ue_header,struct _Unwind_Context * context,void * thrown_ptr,int handler_switch_value,const unsigned char * language_specific_data,_Unwind_Ptr landing_pad,const unsigned char * action_record)152*38fd1498Szrj save_caught_exception(struct _Unwind_Exception* ue_header,
153*38fd1498Szrj 		      struct _Unwind_Context* context,
154*38fd1498Szrj 		      void* thrown_ptr,
155*38fd1498Szrj 		      int handler_switch_value,
156*38fd1498Szrj 		      const unsigned char* language_specific_data,
157*38fd1498Szrj 		      _Unwind_Ptr landing_pad,
158*38fd1498Szrj 		      const unsigned char* action_record
159*38fd1498Szrj 			__attribute__((__unused__)))
160*38fd1498Szrj {
161*38fd1498Szrj     ue_header->barrier_cache.sp = _Unwind_GetGR(context, UNWIND_STACK_REG);
162*38fd1498Szrj     ue_header->barrier_cache.bitpattern[0] = (_uw) thrown_ptr;
163*38fd1498Szrj     ue_header->barrier_cache.bitpattern[1]
164*38fd1498Szrj       = (_uw) handler_switch_value;
165*38fd1498Szrj     ue_header->barrier_cache.bitpattern[2]
166*38fd1498Szrj       = (_uw) language_specific_data;
167*38fd1498Szrj     ue_header->barrier_cache.bitpattern[3] = (_uw) landing_pad;
168*38fd1498Szrj }
169*38fd1498Szrj 
170*38fd1498Szrj 
171*38fd1498Szrj // Restore the catch handler data saved during phase1.
172*38fd1498Szrj 
173*38fd1498Szrj static inline void
restore_caught_exception(struct _Unwind_Exception * ue_header,int & handler_switch_value,const unsigned char * & language_specific_data,_Unwind_Ptr & landing_pad)174*38fd1498Szrj restore_caught_exception(struct _Unwind_Exception* ue_header,
175*38fd1498Szrj 			 int& handler_switch_value,
176*38fd1498Szrj 			 const unsigned char*& language_specific_data,
177*38fd1498Szrj 			 _Unwind_Ptr& landing_pad)
178*38fd1498Szrj {
179*38fd1498Szrj   handler_switch_value = (int) ue_header->barrier_cache.bitpattern[1];
180*38fd1498Szrj   language_specific_data =
181*38fd1498Szrj     (const unsigned char*) ue_header->barrier_cache.bitpattern[2];
182*38fd1498Szrj   landing_pad = (_Unwind_Ptr) ue_header->barrier_cache.bitpattern[3];
183*38fd1498Szrj }
184*38fd1498Szrj 
185*38fd1498Szrj #define CONTINUE_UNWINDING \
186*38fd1498Szrj   do								\
187*38fd1498Szrj     {								\
188*38fd1498Szrj       if (__gnu_unwind_frame(ue_header, context) != _URC_OK)	\
189*38fd1498Szrj 	return _URC_FAILURE;					\
190*38fd1498Szrj       return _URC_CONTINUE_UNWIND;				\
191*38fd1498Szrj     }								\
192*38fd1498Szrj   while (0)
193*38fd1498Szrj 
194*38fd1498Szrj // Return true if the filter spec is empty, ie throw().
195*38fd1498Szrj 
196*38fd1498Szrj static bool
empty_exception_spec(lsda_header_info * info,_Unwind_Sword filter_value)197*38fd1498Szrj empty_exception_spec (lsda_header_info *info, _Unwind_Sword filter_value)
198*38fd1498Szrj {
199*38fd1498Szrj   const _Unwind_Word* e = ((const _Unwind_Word*) info->TType)
200*38fd1498Szrj 			  - filter_value - 1;
201*38fd1498Szrj 
202*38fd1498Szrj   return *e == 0;
203*38fd1498Szrj }
204*38fd1498Szrj 
205*38fd1498Szrj #else
206*38fd1498Szrj typedef const std::type_info _throw_typet;
207*38fd1498Szrj 
208*38fd1498Szrj 
209*38fd1498Szrj // Given the thrown type THROW_TYPE, pointer to a variable containing a
210*38fd1498Szrj // pointer to the exception object THROWN_PTR_P and a type CATCH_TYPE to
211*38fd1498Szrj // compare against, return whether or not there is a match and if so,
212*38fd1498Szrj // update *THROWN_PTR_P.
213*38fd1498Szrj 
214*38fd1498Szrj static bool
get_adjusted_ptr(const std::type_info * catch_type,const std::type_info * throw_type,void ** thrown_ptr_p)215*38fd1498Szrj get_adjusted_ptr (const std::type_info *catch_type,
216*38fd1498Szrj 		  const std::type_info *throw_type,
217*38fd1498Szrj 		  void **thrown_ptr_p)
218*38fd1498Szrj {
219*38fd1498Szrj   void *thrown_ptr = *thrown_ptr_p;
220*38fd1498Szrj 
221*38fd1498Szrj   // Pointer types need to adjust the actual pointer, not
222*38fd1498Szrj   // the pointer to pointer that is the exception object.
223*38fd1498Szrj   // This also has the effect of passing pointer types
224*38fd1498Szrj   // "by value" through the __cxa_begin_catch return value.
225*38fd1498Szrj   if (throw_type->__is_pointer_p ())
226*38fd1498Szrj     thrown_ptr = *(void **) thrown_ptr;
227*38fd1498Szrj 
228*38fd1498Szrj   if (catch_type->__do_catch (throw_type, &thrown_ptr, 1))
229*38fd1498Szrj     {
230*38fd1498Szrj       *thrown_ptr_p = thrown_ptr;
231*38fd1498Szrj       return true;
232*38fd1498Szrj     }
233*38fd1498Szrj 
234*38fd1498Szrj   return false;
235*38fd1498Szrj }
236*38fd1498Szrj 
237*38fd1498Szrj // Return true if THROW_TYPE matches one if the filter types.
238*38fd1498Szrj 
239*38fd1498Szrj static bool
check_exception_spec(lsda_header_info * info,_throw_typet * throw_type,void * thrown_ptr,_sleb128_t filter_value)240*38fd1498Szrj check_exception_spec(lsda_header_info* info, _throw_typet* throw_type,
241*38fd1498Szrj 		      void* thrown_ptr, _sleb128_t filter_value)
242*38fd1498Szrj {
243*38fd1498Szrj   const unsigned char *e = info->TType - filter_value - 1;
244*38fd1498Szrj 
245*38fd1498Szrj   while (1)
246*38fd1498Szrj     {
247*38fd1498Szrj       const std::type_info *catch_type;
248*38fd1498Szrj       _uleb128_t tmp;
249*38fd1498Szrj 
250*38fd1498Szrj       e = read_uleb128 (e, &tmp);
251*38fd1498Szrj 
252*38fd1498Szrj       // Zero signals the end of the list.  If we've not found
253*38fd1498Szrj       // a match by now, then we've failed the specification.
254*38fd1498Szrj       if (tmp == 0)
255*38fd1498Szrj         return false;
256*38fd1498Szrj 
257*38fd1498Szrj       // Match a ttype entry.
258*38fd1498Szrj       catch_type = get_ttype_entry (info, tmp);
259*38fd1498Szrj 
260*38fd1498Szrj       // ??? There is currently no way to ask the RTTI code about the
261*38fd1498Szrj       // relationship between two types without reference to a specific
262*38fd1498Szrj       // object.  There should be; then we wouldn't need to mess with
263*38fd1498Szrj       // thrown_ptr here.
264*38fd1498Szrj       if (get_adjusted_ptr (catch_type, throw_type, &thrown_ptr))
265*38fd1498Szrj 	return true;
266*38fd1498Szrj     }
267*38fd1498Szrj }
268*38fd1498Szrj 
269*38fd1498Szrj 
270*38fd1498Szrj // Save stage1 handler information in the exception object
271*38fd1498Szrj 
272*38fd1498Szrj static inline void
save_caught_exception(struct _Unwind_Exception * ue_header,struct _Unwind_Context * context,void * thrown_ptr,int handler_switch_value,const unsigned char * language_specific_data,_Unwind_Ptr landing_pad,const unsigned char * action_record)273*38fd1498Szrj save_caught_exception(struct _Unwind_Exception* ue_header,
274*38fd1498Szrj 		      struct _Unwind_Context* context
275*38fd1498Szrj 			__attribute__((__unused__)),
276*38fd1498Szrj 		      void* thrown_ptr,
277*38fd1498Szrj 		      int handler_switch_value,
278*38fd1498Szrj 		      const unsigned char* language_specific_data,
279*38fd1498Szrj 		      _Unwind_Ptr landing_pad __attribute__((__unused__)),
280*38fd1498Szrj 		      const unsigned char* action_record)
281*38fd1498Szrj {
282*38fd1498Szrj   __cxa_exception* xh = __get_exception_header_from_ue(ue_header);
283*38fd1498Szrj 
284*38fd1498Szrj   xh->handlerSwitchValue = handler_switch_value;
285*38fd1498Szrj   xh->actionRecord = action_record;
286*38fd1498Szrj   xh->languageSpecificData = language_specific_data;
287*38fd1498Szrj   xh->adjustedPtr = thrown_ptr;
288*38fd1498Szrj 
289*38fd1498Szrj   // ??? Completely unknown what this field is supposed to be for.
290*38fd1498Szrj   // ??? Need to cache TType encoding base for call_unexpected.
291*38fd1498Szrj   xh->catchTemp = landing_pad;
292*38fd1498Szrj }
293*38fd1498Szrj 
294*38fd1498Szrj 
295*38fd1498Szrj // Restore the catch handler information saved during phase1.
296*38fd1498Szrj 
297*38fd1498Szrj static inline void
restore_caught_exception(struct _Unwind_Exception * ue_header,int & handler_switch_value,const unsigned char * & language_specific_data,_Unwind_Ptr & landing_pad)298*38fd1498Szrj restore_caught_exception(struct _Unwind_Exception* ue_header,
299*38fd1498Szrj 			 int& handler_switch_value,
300*38fd1498Szrj 			 const unsigned char*& language_specific_data,
301*38fd1498Szrj 			 _Unwind_Ptr& landing_pad)
302*38fd1498Szrj {
303*38fd1498Szrj   __cxa_exception* xh = __get_exception_header_from_ue(ue_header);
304*38fd1498Szrj   handler_switch_value = xh->handlerSwitchValue;
305*38fd1498Szrj   language_specific_data = xh->languageSpecificData;
306*38fd1498Szrj   landing_pad = (_Unwind_Ptr) xh->catchTemp;
307*38fd1498Szrj }
308*38fd1498Szrj 
309*38fd1498Szrj #define CONTINUE_UNWINDING return _URC_CONTINUE_UNWIND
310*38fd1498Szrj 
311*38fd1498Szrj // Return true if the filter spec is empty, ie throw().
312*38fd1498Szrj 
313*38fd1498Szrj static bool
empty_exception_spec(lsda_header_info * info,_Unwind_Sword filter_value)314*38fd1498Szrj empty_exception_spec (lsda_header_info *info, _Unwind_Sword filter_value)
315*38fd1498Szrj {
316*38fd1498Szrj   const unsigned char *e = info->TType - filter_value - 1;
317*38fd1498Szrj   _uleb128_t tmp;
318*38fd1498Szrj 
319*38fd1498Szrj   e = read_uleb128 (e, &tmp);
320*38fd1498Szrj   return tmp == 0;
321*38fd1498Szrj }
322*38fd1498Szrj 
323*38fd1498Szrj #endif // !__ARM_EABI_UNWINDER__
324*38fd1498Szrj 
325*38fd1498Szrj namespace __cxxabiv1
326*38fd1498Szrj {
327*38fd1498Szrj 
328*38fd1498Szrj // Using a different personality function name causes link failures
329*38fd1498Szrj // when trying to mix code using different exception handling models.
330*38fd1498Szrj #ifdef __USING_SJLJ_EXCEPTIONS__
331*38fd1498Szrj #define PERSONALITY_FUNCTION	__gxx_personality_sj0
332*38fd1498Szrj #define __builtin_eh_return_data_regno(x) x
333*38fd1498Szrj #elif defined(__SEH__)
334*38fd1498Szrj #define PERSONALITY_FUNCTION	__gxx_personality_imp
335*38fd1498Szrj #else
336*38fd1498Szrj #define PERSONALITY_FUNCTION	__gxx_personality_v0
337*38fd1498Szrj #endif
338*38fd1498Szrj 
339*38fd1498Szrj #if defined (__SEH__) && !defined (__USING_SJLJ_EXCEPTIONS__)
340*38fd1498Szrj static
341*38fd1498Szrj #else
342*38fd1498Szrj extern "C"
343*38fd1498Szrj #endif
344*38fd1498Szrj _Unwind_Reason_Code
345*38fd1498Szrj #ifdef __ARM_EABI_UNWINDER__
PERSONALITY_FUNCTION(_Unwind_State state,struct _Unwind_Exception * ue_header,struct _Unwind_Context * context)346*38fd1498Szrj PERSONALITY_FUNCTION (_Unwind_State state,
347*38fd1498Szrj 		      struct _Unwind_Exception* ue_header,
348*38fd1498Szrj 		      struct _Unwind_Context* context)
349*38fd1498Szrj #else
350*38fd1498Szrj PERSONALITY_FUNCTION (int version,
351*38fd1498Szrj 		      _Unwind_Action actions,
352*38fd1498Szrj 		      _Unwind_Exception_Class exception_class,
353*38fd1498Szrj 		      struct _Unwind_Exception *ue_header,
354*38fd1498Szrj 		      struct _Unwind_Context *context)
355*38fd1498Szrj #endif
356*38fd1498Szrj {
357*38fd1498Szrj   enum found_handler_type
358*38fd1498Szrj   {
359*38fd1498Szrj     found_nothing,
360*38fd1498Szrj     found_terminate,
361*38fd1498Szrj     found_cleanup,
362*38fd1498Szrj     found_handler
363*38fd1498Szrj   } found_type;
364*38fd1498Szrj 
365*38fd1498Szrj   lsda_header_info info;
366*38fd1498Szrj   const unsigned char *language_specific_data;
367*38fd1498Szrj   const unsigned char *action_record;
368*38fd1498Szrj   const unsigned char *p;
369*38fd1498Szrj   _Unwind_Ptr landing_pad, ip;
370*38fd1498Szrj   int handler_switch_value;
371*38fd1498Szrj   void* thrown_ptr = 0;
372*38fd1498Szrj   bool foreign_exception;
373*38fd1498Szrj   int ip_before_insn = 0;
374*38fd1498Szrj 
375*38fd1498Szrj #ifdef __ARM_EABI_UNWINDER__
376*38fd1498Szrj   _Unwind_Action actions;
377*38fd1498Szrj 
378*38fd1498Szrj   switch (state & _US_ACTION_MASK)
379*38fd1498Szrj     {
380*38fd1498Szrj     case _US_VIRTUAL_UNWIND_FRAME:
381*38fd1498Szrj       // If the unwind state pattern is
382*38fd1498Szrj       // _US_VIRTUAL_UNWIND_FRAME | _US_FORCE_UNWIND
383*38fd1498Szrj       // then we don't need to search for any handler as it is not a real
384*38fd1498Szrj       // exception. Just unwind the stack.
385*38fd1498Szrj       if (state & _US_FORCE_UNWIND)
386*38fd1498Szrj 	CONTINUE_UNWINDING;
387*38fd1498Szrj       actions = _UA_SEARCH_PHASE;
388*38fd1498Szrj       break;
389*38fd1498Szrj 
390*38fd1498Szrj     case _US_UNWIND_FRAME_STARTING:
391*38fd1498Szrj       actions = _UA_CLEANUP_PHASE;
392*38fd1498Szrj       if (!(state & _US_FORCE_UNWIND)
393*38fd1498Szrj 	  && ue_header->barrier_cache.sp == _Unwind_GetGR(context,
394*38fd1498Szrj 							  UNWIND_STACK_REG))
395*38fd1498Szrj 	actions |= _UA_HANDLER_FRAME;
396*38fd1498Szrj       break;
397*38fd1498Szrj 
398*38fd1498Szrj     case _US_UNWIND_FRAME_RESUME:
399*38fd1498Szrj       CONTINUE_UNWINDING;
400*38fd1498Szrj       break;
401*38fd1498Szrj 
402*38fd1498Szrj     default:
403*38fd1498Szrj       std::abort();
404*38fd1498Szrj     }
405*38fd1498Szrj   actions |= state & _US_FORCE_UNWIND;
406*38fd1498Szrj 
407*38fd1498Szrj   // We don't know which runtime we're working with, so can't check this.
408*38fd1498Szrj   // However the ABI routines hide this from us, and we don't actually need
409*38fd1498Szrj   // to know.
410*38fd1498Szrj   foreign_exception = false;
411*38fd1498Szrj 
412*38fd1498Szrj   // The dwarf unwinder assumes the context structure holds things like the
413*38fd1498Szrj   // function and LSDA pointers.  The ARM implementation caches these in
414*38fd1498Szrj   // the exception header (UCB).  To avoid rewriting everything we make a
415*38fd1498Szrj   // virtual scratch register point at the UCB.
416*38fd1498Szrj   ip = (_Unwind_Ptr) ue_header;
417*38fd1498Szrj   _Unwind_SetGR(context, UNWIND_POINTER_REG, ip);
418*38fd1498Szrj #else
419*38fd1498Szrj   __cxa_exception* xh = __get_exception_header_from_ue(ue_header);
420*38fd1498Szrj 
421*38fd1498Szrj   // Interface version check.
422*38fd1498Szrj   if (version != 1)
423*38fd1498Szrj     return _URC_FATAL_PHASE1_ERROR;
424*38fd1498Szrj   foreign_exception = !__is_gxx_exception_class(exception_class);
425*38fd1498Szrj #endif
426*38fd1498Szrj 
427*38fd1498Szrj   // Shortcut for phase 2 found handler for domestic exception.
428*38fd1498Szrj   if (actions == (_UA_CLEANUP_PHASE | _UA_HANDLER_FRAME)
429*38fd1498Szrj       && !foreign_exception)
430*38fd1498Szrj     {
431*38fd1498Szrj       restore_caught_exception(ue_header, handler_switch_value,
432*38fd1498Szrj 			       language_specific_data, landing_pad);
433*38fd1498Szrj       found_type = (landing_pad == 0 ? found_terminate : found_handler);
434*38fd1498Szrj       goto install_context;
435*38fd1498Szrj     }
436*38fd1498Szrj 
437*38fd1498Szrj   language_specific_data = (const unsigned char *)
438*38fd1498Szrj     _Unwind_GetLanguageSpecificData (context);
439*38fd1498Szrj 
440*38fd1498Szrj   // If no LSDA, then there are no handlers or cleanups.
441*38fd1498Szrj   if (! language_specific_data)
442*38fd1498Szrj     CONTINUE_UNWINDING;
443*38fd1498Szrj 
444*38fd1498Szrj   // Parse the LSDA header.
445*38fd1498Szrj   p = parse_lsda_header (context, language_specific_data, &info);
446*38fd1498Szrj   info.ttype_base = base_of_encoded_value (info.ttype_encoding, context);
447*38fd1498Szrj #ifdef _GLIBCXX_HAVE_GETIPINFO
448*38fd1498Szrj   ip = _Unwind_GetIPInfo (context, &ip_before_insn);
449*38fd1498Szrj #else
450*38fd1498Szrj   ip = _Unwind_GetIP (context);
451*38fd1498Szrj #endif
452*38fd1498Szrj   if (! ip_before_insn)
453*38fd1498Szrj     --ip;
454*38fd1498Szrj   landing_pad = 0;
455*38fd1498Szrj   action_record = 0;
456*38fd1498Szrj   handler_switch_value = 0;
457*38fd1498Szrj 
458*38fd1498Szrj #ifdef __USING_SJLJ_EXCEPTIONS__
459*38fd1498Szrj   // The given "IP" is an index into the call-site table, with two
460*38fd1498Szrj   // exceptions -- -1 means no-action, and 0 means terminate.  But
461*38fd1498Szrj   // since we're using uleb128 values, we've not got random access
462*38fd1498Szrj   // to the array.
463*38fd1498Szrj   if ((int) ip < 0)
464*38fd1498Szrj     return _URC_CONTINUE_UNWIND;
465*38fd1498Szrj   else if (ip == 0)
466*38fd1498Szrj     {
467*38fd1498Szrj       // Fall through to set found_terminate.
468*38fd1498Szrj     }
469*38fd1498Szrj   else
470*38fd1498Szrj     {
471*38fd1498Szrj       _uleb128_t cs_lp, cs_action;
472*38fd1498Szrj       do
473*38fd1498Szrj 	{
474*38fd1498Szrj 	  p = read_uleb128 (p, &cs_lp);
475*38fd1498Szrj 	  p = read_uleb128 (p, &cs_action);
476*38fd1498Szrj 	}
477*38fd1498Szrj       while (--ip);
478*38fd1498Szrj 
479*38fd1498Szrj       // Can never have null landing pad for sjlj -- that would have
480*38fd1498Szrj       // been indicated by a -1 call site index.
481*38fd1498Szrj       landing_pad = cs_lp + 1;
482*38fd1498Szrj       if (cs_action)
483*38fd1498Szrj 	action_record = info.action_table + cs_action - 1;
484*38fd1498Szrj       goto found_something;
485*38fd1498Szrj     }
486*38fd1498Szrj #else
487*38fd1498Szrj   // Search the call-site table for the action associated with this IP.
488*38fd1498Szrj   while (p < info.action_table)
489*38fd1498Szrj     {
490*38fd1498Szrj       _Unwind_Ptr cs_start, cs_len, cs_lp;
491*38fd1498Szrj       _uleb128_t cs_action;
492*38fd1498Szrj 
493*38fd1498Szrj       // Note that all call-site encodings are "absolute" displacements.
494*38fd1498Szrj       p = read_encoded_value (0, info.call_site_encoding, p, &cs_start);
495*38fd1498Szrj       p = read_encoded_value (0, info.call_site_encoding, p, &cs_len);
496*38fd1498Szrj       p = read_encoded_value (0, info.call_site_encoding, p, &cs_lp);
497*38fd1498Szrj       p = read_uleb128 (p, &cs_action);
498*38fd1498Szrj 
499*38fd1498Szrj       // The table is sorted, so if we've passed the ip, stop.
500*38fd1498Szrj       if (ip < info.Start + cs_start)
501*38fd1498Szrj 	p = info.action_table;
502*38fd1498Szrj       else if (ip < info.Start + cs_start + cs_len)
503*38fd1498Szrj 	{
504*38fd1498Szrj 	  if (cs_lp)
505*38fd1498Szrj 	    landing_pad = info.LPStart + cs_lp;
506*38fd1498Szrj 	  if (cs_action)
507*38fd1498Szrj 	    action_record = info.action_table + cs_action - 1;
508*38fd1498Szrj 	  goto found_something;
509*38fd1498Szrj 	}
510*38fd1498Szrj     }
511*38fd1498Szrj #endif // __USING_SJLJ_EXCEPTIONS__
512*38fd1498Szrj 
513*38fd1498Szrj   // If ip is not present in the table, call terminate.  This is for
514*38fd1498Szrj   // a destructor inside a cleanup, or a library routine the compiler
515*38fd1498Szrj   // was not expecting to throw.
516*38fd1498Szrj   found_type = found_terminate;
517*38fd1498Szrj   goto do_something;
518*38fd1498Szrj 
519*38fd1498Szrj  found_something:
520*38fd1498Szrj   if (landing_pad == 0)
521*38fd1498Szrj     {
522*38fd1498Szrj       // If ip is present, and has a null landing pad, there are
523*38fd1498Szrj       // no cleanups or handlers to be run.
524*38fd1498Szrj       found_type = found_nothing;
525*38fd1498Szrj     }
526*38fd1498Szrj   else if (action_record == 0)
527*38fd1498Szrj     {
528*38fd1498Szrj       // If ip is present, has a non-null landing pad, and a null
529*38fd1498Szrj       // action table offset, then there are only cleanups present.
530*38fd1498Szrj       // Cleanups use a zero switch value, as set above.
531*38fd1498Szrj       found_type = found_cleanup;
532*38fd1498Szrj     }
533*38fd1498Szrj   else
534*38fd1498Szrj     {
535*38fd1498Szrj       // Otherwise we have a catch handler or exception specification.
536*38fd1498Szrj 
537*38fd1498Szrj       _sleb128_t ar_filter, ar_disp;
538*38fd1498Szrj       const std::type_info* catch_type;
539*38fd1498Szrj       _throw_typet* throw_type;
540*38fd1498Szrj       bool saw_cleanup = false;
541*38fd1498Szrj       bool saw_handler = false;
542*38fd1498Szrj 
543*38fd1498Szrj #ifdef __ARM_EABI_UNWINDER__
544*38fd1498Szrj       // ??? How does this work - more importantly, how does it interact with
545*38fd1498Szrj       // dependent exceptions?
546*38fd1498Szrj       throw_type = ue_header;
547*38fd1498Szrj       if (actions & _UA_FORCE_UNWIND)
548*38fd1498Szrj 	{
549*38fd1498Szrj 	  __GXX_INIT_FORCED_UNWIND_CLASS(ue_header->exception_class);
550*38fd1498Szrj 	}
551*38fd1498Szrj       else if (!foreign_exception)
552*38fd1498Szrj 	thrown_ptr = __get_object_from_ue (ue_header);
553*38fd1498Szrj #else
554*38fd1498Szrj #if __cpp_rtti
555*38fd1498Szrj       // During forced unwinding, match a magic exception type.
556*38fd1498Szrj       if (actions & _UA_FORCE_UNWIND)
557*38fd1498Szrj 	{
558*38fd1498Szrj 	  throw_type = &typeid(abi::__forced_unwind);
559*38fd1498Szrj 	}
560*38fd1498Szrj       // With a foreign exception class, there's no exception type.
561*38fd1498Szrj       // ??? What to do about GNU Java and GNU Ada exceptions?
562*38fd1498Szrj       else if (foreign_exception)
563*38fd1498Szrj 	{
564*38fd1498Szrj 	  throw_type = &typeid(abi::__foreign_exception);
565*38fd1498Szrj 	}
566*38fd1498Szrj       else
567*38fd1498Szrj #endif
568*38fd1498Szrj         {
569*38fd1498Szrj           thrown_ptr = __get_object_from_ue (ue_header);
570*38fd1498Szrj           throw_type = __get_exception_header_from_obj
571*38fd1498Szrj             (thrown_ptr)->exceptionType;
572*38fd1498Szrj         }
573*38fd1498Szrj #endif
574*38fd1498Szrj 
575*38fd1498Szrj       while (1)
576*38fd1498Szrj 	{
577*38fd1498Szrj 	  p = action_record;
578*38fd1498Szrj 	  p = read_sleb128 (p, &ar_filter);
579*38fd1498Szrj 	  read_sleb128 (p, &ar_disp);
580*38fd1498Szrj 
581*38fd1498Szrj 	  if (ar_filter == 0)
582*38fd1498Szrj 	    {
583*38fd1498Szrj 	      // Zero filter values are cleanups.
584*38fd1498Szrj 	      saw_cleanup = true;
585*38fd1498Szrj 	    }
586*38fd1498Szrj 	  else if (ar_filter > 0)
587*38fd1498Szrj 	    {
588*38fd1498Szrj 	      // Positive filter values are handlers.
589*38fd1498Szrj 	      catch_type = get_ttype_entry (&info, ar_filter);
590*38fd1498Szrj 
591*38fd1498Szrj 	      // Null catch type is a catch-all handler; we can catch foreign
592*38fd1498Szrj 	      // exceptions with this.  Otherwise we must match types.
593*38fd1498Szrj 	      if (! catch_type
594*38fd1498Szrj 		  || (throw_type
595*38fd1498Szrj 		      && get_adjusted_ptr (catch_type, throw_type,
596*38fd1498Szrj 					   &thrown_ptr)))
597*38fd1498Szrj 		{
598*38fd1498Szrj 		  saw_handler = true;
599*38fd1498Szrj 		  break;
600*38fd1498Szrj 		}
601*38fd1498Szrj 	    }
602*38fd1498Szrj 	  else
603*38fd1498Szrj 	    {
604*38fd1498Szrj 	      // Negative filter values are exception specifications.
605*38fd1498Szrj 	      // ??? How do foreign exceptions fit in?  As far as I can
606*38fd1498Szrj 	      // see we can't match because there's no __cxa_exception
607*38fd1498Szrj 	      // object to stuff bits in for __cxa_call_unexpected to use.
608*38fd1498Szrj 	      // Allow them iff the exception spec is non-empty.  I.e.
609*38fd1498Szrj 	      // a throw() specification results in __unexpected.
610*38fd1498Szrj 	      if ((throw_type
611*38fd1498Szrj 		   && !(actions & _UA_FORCE_UNWIND)
612*38fd1498Szrj 		   && !foreign_exception)
613*38fd1498Szrj 		  ? ! check_exception_spec (&info, throw_type, thrown_ptr,
614*38fd1498Szrj 					    ar_filter)
615*38fd1498Szrj 		  : empty_exception_spec (&info, ar_filter))
616*38fd1498Szrj 		{
617*38fd1498Szrj 		  saw_handler = true;
618*38fd1498Szrj 		  break;
619*38fd1498Szrj 		}
620*38fd1498Szrj 	    }
621*38fd1498Szrj 
622*38fd1498Szrj 	  if (ar_disp == 0)
623*38fd1498Szrj 	    break;
624*38fd1498Szrj 	  action_record = p + ar_disp;
625*38fd1498Szrj 	}
626*38fd1498Szrj 
627*38fd1498Szrj       if (saw_handler)
628*38fd1498Szrj 	{
629*38fd1498Szrj 	  handler_switch_value = ar_filter;
630*38fd1498Szrj 	  found_type = found_handler;
631*38fd1498Szrj 	}
632*38fd1498Szrj       else
633*38fd1498Szrj 	found_type = (saw_cleanup ? found_cleanup : found_nothing);
634*38fd1498Szrj     }
635*38fd1498Szrj 
636*38fd1498Szrj  do_something:
637*38fd1498Szrj    if (found_type == found_nothing)
638*38fd1498Szrj      CONTINUE_UNWINDING;
639*38fd1498Szrj 
640*38fd1498Szrj   if (actions & _UA_SEARCH_PHASE)
641*38fd1498Szrj     {
642*38fd1498Szrj       if (found_type == found_cleanup)
643*38fd1498Szrj 	CONTINUE_UNWINDING;
644*38fd1498Szrj 
645*38fd1498Szrj       // For domestic exceptions, we cache data from phase 1 for phase 2.
646*38fd1498Szrj       if (!foreign_exception)
647*38fd1498Szrj         {
648*38fd1498Szrj 	  save_caught_exception(ue_header, context, thrown_ptr,
649*38fd1498Szrj 				handler_switch_value, language_specific_data,
650*38fd1498Szrj 				landing_pad, action_record);
651*38fd1498Szrj 	}
652*38fd1498Szrj       return _URC_HANDLER_FOUND;
653*38fd1498Szrj     }
654*38fd1498Szrj 
655*38fd1498Szrj  install_context:
656*38fd1498Szrj 
657*38fd1498Szrj   // We can't use any of the cxa routines with foreign exceptions,
658*38fd1498Szrj   // because they all expect ue_header to be a struct __cxa_exception.
659*38fd1498Szrj   // So in that case, call terminate or unexpected directly.
660*38fd1498Szrj   if ((actions & _UA_FORCE_UNWIND)
661*38fd1498Szrj       || foreign_exception)
662*38fd1498Szrj     {
663*38fd1498Szrj       if (found_type == found_terminate)
664*38fd1498Szrj 	std::terminate ();
665*38fd1498Szrj       else if (handler_switch_value < 0)
666*38fd1498Szrj 	{
667*38fd1498Szrj 	  __try
668*38fd1498Szrj 	    { std::unexpected (); }
669*38fd1498Szrj 	  __catch(...)
670*38fd1498Szrj 	    { std::terminate (); }
671*38fd1498Szrj 	}
672*38fd1498Szrj     }
673*38fd1498Szrj   else
674*38fd1498Szrj     {
675*38fd1498Szrj       if (found_type == found_terminate)
676*38fd1498Szrj 	__cxa_call_terminate(ue_header);
677*38fd1498Szrj 
678*38fd1498Szrj       // Cache the TType base value for __cxa_call_unexpected, as we won't
679*38fd1498Szrj       // have an _Unwind_Context then.
680*38fd1498Szrj       if (handler_switch_value < 0)
681*38fd1498Szrj 	{
682*38fd1498Szrj 	  parse_lsda_header (context, language_specific_data, &info);
683*38fd1498Szrj 	  info.ttype_base = base_of_encoded_value (info.ttype_encoding,
684*38fd1498Szrj 						   context);
685*38fd1498Szrj 
686*38fd1498Szrj #ifdef __ARM_EABI_UNWINDER__
687*38fd1498Szrj 	  const _Unwind_Word* e;
688*38fd1498Szrj 	  _Unwind_Word n;
689*38fd1498Szrj 
690*38fd1498Szrj 	  e = ((const _Unwind_Word*) info.TType) - handler_switch_value - 1;
691*38fd1498Szrj 	  // Count the number of rtti objects.
692*38fd1498Szrj 	  n = 0;
693*38fd1498Szrj 	  while (e[n] != 0)
694*38fd1498Szrj 	    n++;
695*38fd1498Szrj 
696*38fd1498Szrj 	  // Count.
697*38fd1498Szrj 	  ue_header->barrier_cache.bitpattern[1] = n;
698*38fd1498Szrj 	  // Base
699*38fd1498Szrj 	  ue_header->barrier_cache.bitpattern[2] = info.ttype_base;
700*38fd1498Szrj 	  // Stride.
701*38fd1498Szrj 	  ue_header->barrier_cache.bitpattern[3] = 4;
702*38fd1498Szrj 	  // List head.
703*38fd1498Szrj 	  ue_header->barrier_cache.bitpattern[4] = (_Unwind_Word) e;
704*38fd1498Szrj #else
705*38fd1498Szrj 	  xh->catchTemp = base_of_encoded_value (info.ttype_encoding, context);
706*38fd1498Szrj #endif
707*38fd1498Szrj 	}
708*38fd1498Szrj     }
709*38fd1498Szrj 
710*38fd1498Szrj   /* For targets with pointers smaller than the word size, we must extend the
711*38fd1498Szrj      pointer, and this extension is target dependent.  */
712*38fd1498Szrj   _Unwind_SetGR (context, __builtin_eh_return_data_regno (0),
713*38fd1498Szrj 		 __builtin_extend_pointer (ue_header));
714*38fd1498Szrj   _Unwind_SetGR (context, __builtin_eh_return_data_regno (1),
715*38fd1498Szrj 		 handler_switch_value);
716*38fd1498Szrj   _Unwind_SetIP (context, landing_pad);
717*38fd1498Szrj #ifdef __ARM_EABI_UNWINDER__
718*38fd1498Szrj   if (found_type == found_cleanup)
719*38fd1498Szrj     __cxa_begin_cleanup(ue_header);
720*38fd1498Szrj #endif
721*38fd1498Szrj   return _URC_INSTALL_CONTEXT;
722*38fd1498Szrj }
723*38fd1498Szrj 
724*38fd1498Szrj /* The ARM EABI implementation of __cxa_call_unexpected is in a
725*38fd1498Szrj    different file so that the personality routine (PR) can be used
726*38fd1498Szrj    standalone.  The generic routine shared datastructures with the PR
727*38fd1498Szrj    so it is most convenient to implement it here.  */
728*38fd1498Szrj #ifndef __ARM_EABI_UNWINDER__
729*38fd1498Szrj extern "C" void
__cxa_call_unexpected(void * exc_obj_in)730*38fd1498Szrj __cxa_call_unexpected (void *exc_obj_in)
731*38fd1498Szrj {
732*38fd1498Szrj   _Unwind_Exception *exc_obj
733*38fd1498Szrj     = reinterpret_cast <_Unwind_Exception *>(exc_obj_in);
734*38fd1498Szrj 
735*38fd1498Szrj   __cxa_begin_catch (exc_obj);
736*38fd1498Szrj 
737*38fd1498Szrj   // This function is a handler for our exception argument.  If we exit
738*38fd1498Szrj   // by throwing a different exception, we'll need the original cleaned up.
739*38fd1498Szrj   struct end_catch_protect
740*38fd1498Szrj   {
741*38fd1498Szrj     end_catch_protect() { }
742*38fd1498Szrj     ~end_catch_protect() { __cxa_end_catch(); }
743*38fd1498Szrj   } end_catch_protect_obj;
744*38fd1498Szrj 
745*38fd1498Szrj   lsda_header_info info;
746*38fd1498Szrj   __cxa_exception *xh = __get_exception_header_from_ue (exc_obj);
747*38fd1498Szrj   const unsigned char *xh_lsda;
748*38fd1498Szrj   _Unwind_Sword xh_switch_value;
749*38fd1498Szrj   std::terminate_handler xh_terminate_handler;
750*38fd1498Szrj 
751*38fd1498Szrj   // If the unexpectedHandler rethrows the exception (e.g. to categorize it),
752*38fd1498Szrj   // it will clobber data about the current handler.  So copy the data out now.
753*38fd1498Szrj   xh_lsda = xh->languageSpecificData;
754*38fd1498Szrj   xh_switch_value = xh->handlerSwitchValue;
755*38fd1498Szrj   xh_terminate_handler = xh->terminateHandler;
756*38fd1498Szrj   info.ttype_base = (_Unwind_Ptr) xh->catchTemp;
757*38fd1498Szrj 
758*38fd1498Szrj   __try
759*38fd1498Szrj     { __unexpected (xh->unexpectedHandler); }
760*38fd1498Szrj   __catch(...)
761*38fd1498Szrj     {
762*38fd1498Szrj       // Get the exception thrown from unexpected.
763*38fd1498Szrj 
764*38fd1498Szrj       __cxa_eh_globals *globals = __cxa_get_globals_fast ();
765*38fd1498Szrj       __cxa_exception *new_xh = globals->caughtExceptions;
766*38fd1498Szrj       void *new_ptr = __get_object_from_ambiguous_exception (new_xh);
767*38fd1498Szrj 
768*38fd1498Szrj       // We don't quite have enough stuff cached; re-parse the LSDA.
769*38fd1498Szrj       parse_lsda_header (0, xh_lsda, &info);
770*38fd1498Szrj 
771*38fd1498Szrj       // If this new exception meets the exception spec, allow it.
772*38fd1498Szrj       if (check_exception_spec (&info, __get_exception_header_from_obj
773*38fd1498Szrj                                   (new_ptr)->exceptionType,
774*38fd1498Szrj 				new_ptr, xh_switch_value))
775*38fd1498Szrj 	{ __throw_exception_again; }
776*38fd1498Szrj 
777*38fd1498Szrj       // If the exception spec allows std::bad_exception, throw that.
778*38fd1498Szrj       // We don't have a thrown object to compare against, but since
779*38fd1498Szrj       // bad_exception doesn't have virtual bases, that's OK; just pass 0.
780*38fd1498Szrj #if __cpp_exceptions && __cpp_rtti
781*38fd1498Szrj       const std::type_info &bad_exc = typeid (std::bad_exception);
782*38fd1498Szrj       if (check_exception_spec (&info, &bad_exc, 0, xh_switch_value))
783*38fd1498Szrj 	throw std::bad_exception();
784*38fd1498Szrj #endif
785*38fd1498Szrj 
786*38fd1498Szrj       // Otherwise, die.
787*38fd1498Szrj       __terminate (xh_terminate_handler);
788*38fd1498Szrj     }
789*38fd1498Szrj }
790*38fd1498Szrj #endif
791*38fd1498Szrj 
792*38fd1498Szrj #if defined (__SEH__) && !defined (__USING_SJLJ_EXCEPTIONS__)
793*38fd1498Szrj extern "C"
794*38fd1498Szrj EXCEPTION_DISPOSITION
__gxx_personality_seh0(PEXCEPTION_RECORD ms_exc,void * this_frame,PCONTEXT ms_orig_context,PDISPATCHER_CONTEXT ms_disp)795*38fd1498Szrj __gxx_personality_seh0 (PEXCEPTION_RECORD ms_exc, void *this_frame,
796*38fd1498Szrj 			PCONTEXT ms_orig_context, PDISPATCHER_CONTEXT ms_disp)
797*38fd1498Szrj {
798*38fd1498Szrj   return _GCC_specific_handler (ms_exc, this_frame, ms_orig_context,
799*38fd1498Szrj 				ms_disp, __gxx_personality_imp);
800*38fd1498Szrj }
801*38fd1498Szrj #endif /* SEH */
802*38fd1498Szrj 
803*38fd1498Szrj } // namespace __cxxabiv1
804