Skip to content

Commit 63e53b8

Browse files
committed
rt: Support SEH/SJLJ personality routine
1 parent ef20bd4 commit 63e53b8

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/rt/rust_upcall.cpp

+16-6
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,18 @@ upcall_call_shim_on_rust_stack(void *args, void *fn_ptr) {
5454

5555
/**********************************************************************/
5656

57+
#ifdef __SEH__
58+
# define PERSONALITY_FUNC __gxx_personality_seh0
59+
#else
60+
# ifdef __USING_SJLJ_EXCEPTIONS__
61+
# define PERSONALITY_FUNC __gxx_personality_sjlj
62+
# else
63+
# define PERSONALITY_FUNC __gxx_personality_v0
64+
# endif
65+
#endif
66+
5767
extern "C" _Unwind_Reason_Code
58-
__gxx_personality_v0(int version,
68+
PERSONALITY_FUNC(int version,
5969
_Unwind_Action actions,
6070
uint64_t exception_class,
6171
_Unwind_Exception *ue_header,
@@ -72,11 +82,11 @@ struct s_rust_personality_args {
7282

7383
extern "C" void
7484
upcall_s_rust_personality(s_rust_personality_args *args) {
75-
args->retval = __gxx_personality_v0(args->version,
76-
args->actions,
77-
args->exception_class,
78-
args->ue_header,
79-
args->context);
85+
args->retval = PERSONALITY_FUNC(args->version,
86+
args->actions,
87+
args->exception_class,
88+
args->ue_header,
89+
args->context);
8090
}
8191

8292
/**

0 commit comments

Comments
 (0)