Skip to content

Commit 9f4b4d8

Browse files
committed
Add upcall_rust_personality
This just wraps __gxx_personality_v0 with our upcall naming convention Issue #236
1 parent f1e348c commit 9f4b4d8

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

src/comp/back/upcall.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ type upcalls =
3737
log_type: ValueRef,
3838
dynastack_mark: ValueRef,
3939
dynastack_alloc: ValueRef,
40-
dynastack_free: ValueRef};
40+
dynastack_free: ValueRef,
41+
rust_personality: ValueRef};
4142

4243
fn declare_upcalls(_tn: type_names, tydesc_type: TypeRef,
4344
taskptr_type: TypeRef, llmod: ModuleRef) -> @upcalls {
@@ -89,7 +90,9 @@ fn declare_upcalls(_tn: type_names, tydesc_type: TypeRef,
8990
dynastack_alloc:
9091
d("dynastack_alloc_2", [T_size_t(), T_ptr(tydesc_type)],
9192
T_ptr(T_i8())),
92-
dynastack_free: d("dynastack_free", [T_ptr(T_i8())], T_void())};
93+
dynastack_free: d("dynastack_free", [T_ptr(T_i8())], T_void()),
94+
rust_personality: dr("rust_personality", [], T_i32())
95+
};
9396
}
9497
//
9598
// Local Variables:

src/rt/rust_upcall.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#include "rust_gc.h"
22
#include "rust_internal.h"
33
#include "rust_upcall.h"
4+
#include <stdint.h>
5+
#include <unwind.h>
46

57
// Upcalls.
68

@@ -190,6 +192,26 @@ upcall_dynastack_free(rust_task *task, void *ptr) {
190192
return task->dynastack.free(ptr);
191193
}
192194

195+
extern "C" _Unwind_Reason_Code
196+
__gxx_personality_v0(int version,
197+
_Unwind_Action actions,
198+
uint64_t exception_class,
199+
_Unwind_Exception *ue_header,
200+
_Unwind_Context *context);
201+
202+
extern "C" _Unwind_Reason_Code
203+
upcall_rust_personality(int version,
204+
_Unwind_Action actions,
205+
uint64_t exception_class,
206+
_Unwind_Exception *ue_header,
207+
_Unwind_Context *context) {
208+
return __gxx_personality_v0(version,
209+
actions,
210+
exception_class,
211+
ue_header,
212+
context);
213+
}
214+
193215
//
194216
// Local Variables:
195217
// mode: C++

src/rt/rustrt.def.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,6 @@ upcall_vec_grow
7878
upcall_vec_push
7979
upcall_log_type
8080
upcall_malloc
81+
upcall_rust_personality
8182
upcall_shared_malloc
8283
upcall_shared_free

0 commit comments

Comments
 (0)