From 3f15a75d2f059828a390477eb9667ff36ff07f1b Mon Sep 17 00:00:00 2001 From: midipix Date: Mon, 11 Mar 2019 06:41:17 -0400 Subject: libsupc++/eh_personality.cc: support target-provided exception filters. --- libstdc++-v3/libsupc++/eh_personality.cc | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/libstdc++-v3/libsupc++/eh_personality.cc b/libstdc++-v3/libsupc++/eh_personality.cc index 19c204473..3ef761515 100644 --- a/libstdc++-v3/libsupc++/eh_personality.cc +++ b/libstdc++-v3/libsupc++/eh_personality.cc @@ -24,6 +24,10 @@ // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // . +#ifdef TARGET_PERSONALITY_FUNCTION_MIDIPIX +#include <../../gcc/unwind-midipix.h> +#endif + #include #include #include @@ -343,11 +347,18 @@ namespace __cxxabiv1 #ifdef _GLIBCXX_SJLJ_EXCEPTIONS #define PERSONALITY_FUNCTION __gxx_personality_sj0 #define __builtin_eh_return_data_regno(x) x +#elif defined(TARGET_PERSONALITY_FUNCTION) +#define PERSONALITY_FUNCTION __gxx_personality_imp #else #define PERSONALITY_FUNCTION __gxx_personality_v0 #endif +#ifdef TARGET_PERSONALITY_FUNCTION +static _Unwind_Reason_Code +#else extern "C" _Unwind_Reason_Code +#endif + #ifdef __ARM_EABI_UNWINDER__ PERSONALITY_FUNCTION (_Unwind_State state, struct _Unwind_Exception* ue_header, @@ -718,6 +729,22 @@ PERSONALITY_FUNCTION (int version, return _URC_INSTALL_CONTEXT; } +#ifdef TARGET_PERSONALITY_FUNCTION_MIDIPIX + +extern "C" +int __gxx_personality_seh0( + struct _nt_exception_record * erec, + void * this_frame, + mcontext_t * tctx, + struct _nt_dispatcher_context * dctx) +{ + return __unwind_exception_filter( + erec,this_frame,tctx,dctx, + __gxx_personality_imp); +} + +#endif + /* The ARM EABI implementation of __cxa_call_unexpected is in a different file so that the personality routine (PR) can be used standalone. The generic routine shared datastructures with the PR -- cgit v1.2.3