From eb6ea6e659f8c46a2730866a8ec9f01cbe856a43 Mon Sep 17 00:00:00 2001 From: midipix Date: Mon, 11 Mar 2019 07:22:24 -0400 Subject: libobjc/exception.c: support target-provided exception filters. --- libobjc/exception.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/libobjc/exception.c b/libobjc/exception.c index 1ffb80b53..239320240 100644 --- a/libobjc/exception.c +++ b/libobjc/exception.c @@ -22,6 +22,10 @@ a copy of the GCC Runtime Library Exception along with this program; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see . */ +#ifdef TARGET_PERSONALITY_FUNCTION_MIDIPIX +#include "unwind-midipix.h" +#endif + #include "objc-private/common.h" #include #include "config.h" @@ -225,6 +229,8 @@ get_ttype_entry (struct lsda_header_info *info, _Unwind_Word i) #ifdef SJLJ_EXCEPTIONS #define PERSONALITY_FUNCTION __gnu_objc_personality_sj0 #define __builtin_eh_return_data_regno(x) x +#elif defined(TARGET_PERSONALITY_FUNCTION) +#define PERSONALITY_FUNCTION __gnu_objc_personality_imp #else #define PERSONALITY_FUNCTION __gnu_objc_personality_v0 #endif @@ -240,6 +246,9 @@ get_ttype_entry (struct lsda_header_info *info, _Unwind_Word i) } \ while (0) +#ifdef TARGET_PERSONALITY_FUNCTION +static +#endif _Unwind_Reason_Code PERSONALITY_FUNCTION (_Unwind_State state, struct _Unwind_Exception *ue_header, @@ -509,6 +518,21 @@ PERSONALITY_FUNCTION (int version, return _URC_INSTALL_CONTEXT; } +#ifdef TARGET_PERSONALITY_FUNCTION_MIDIPIX + +int __gnu_objc_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, + __gnu_objc_personality_imp); +} + +#endif + static void __objc_exception_cleanup (_Unwind_Reason_Code code __attribute__((unused)), struct _Unwind_Exception *exc) -- cgit v1.2.3