@@ -32,9 +32,6 @@ __gxx_personality_v0(int version,
32
32
}
33
33
#endif // !defined(__USING_WASM_EXCEPTIONS__)
34
34
35
- #if defined(__USING_EMSCRIPTEN_EXCEPTIONS__) || \
36
- defined (__USING_WASM_EXCEPTIONS__)
37
-
38
35
using namespace __cxxabiv1 ;
39
36
40
37
// Some utility routines are copied from cxa_exception.cpp
@@ -50,6 +47,9 @@ thrown_object_from_cxa_exception(__cxa_exception* exception_header) {
50
47
return static_cast <void *>(exception_header + 1 );
51
48
}
52
49
50
+ #if defined(__USING_EMSCRIPTEN_EXCEPTIONS__) || \
51
+ defined (__USING_WASM_EXCEPTIONS__)
52
+
53
53
// Get the exception object from the unwind pointer.
54
54
// Relies on the structure layout, where the unwind pointer is right in
55
55
// front of the user's exception object
@@ -130,3 +130,21 @@ char* __get_exception_terminate_message(void* thrown_object) {
130
130
}
131
131
132
132
#endif // __USING_EMSCRIPTEN_EXCEPTIONS__ || __USING_WASM_EXCEPTIONS__
133
+
134
+ #ifndef __USING_WASM_EXCEPTIONS__
135
+
136
+ namespace __cxxabiv1 {
137
+
138
+ void * __cxa_allocate_exception (size_t size) _NOEXCEPT {
139
+ // Thrown object is prepended by exception metadata block
140
+ __cxa_exception* ex = (__cxa_exception*)malloc (size + sizeof (__cxa_exception));
141
+ return thrown_object_from_cxa_exception (ex);
142
+ }
143
+
144
+ void __cxa_free_exception (void *thrown_object) _NOEXCEPT {
145
+ free (cxa_exception_from_thrown_object (thrown_object));
146
+ }
147
+
148
+ }
149
+
150
+ #endif // !__USING_WASM_EXCEPTIONS__
0 commit comments