Skip to content
13 changes: 13 additions & 0 deletions system/lib/libcxxabi/src/cxa_exception_emscripten.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,23 @@
#include "cxa_exception.h"
#include "private_typeinfo.h"
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>

#if defined(__USING_EMSCRIPTEN_EXCEPTIONS__) || \
defined(__USING_WASM_EXCEPTIONS__)

// TODO: Remove this when Rust doesn't need it anymore.
// https://github.com/rust-lang/rust/pull/97888
extern "C" _LIBCXXABI_FUNC_VIS _Unwind_Reason_Code
__gxx_personality_v0(int version,
_Unwind_Action actions,
uint64_t exceptionClass,
_Unwind_Exception* unwind_exception,
_Unwind_Context* context) {
abort();
}

using namespace __cxxabiv1;

// Some utility routines are copied from cxa_exception.cpp
Expand Down
20 changes: 0 additions & 20 deletions system/lib/libcxxabi/src/gxx_personality_stub.cpp

This file was deleted.

4 changes: 2 additions & 2 deletions tests/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -12168,9 +12168,9 @@ def test_rust_gxx_personality_v0(self):
}
}
''')
self.run_process([EMXX, '-c', 'main.cpp'])
self.run_process([EMXX, '-c', 'main.cpp', '-fexceptions'])

self.run_process([EMXX, '-o', 'main.js', 'main.o', '-lc++abi'] + self.get_emcc_args())
self.run_process([EMXX, '-o', 'main.js', 'main.o', '-fexceptions'] + self.get_emcc_args())

try:
self.do_run('main.js', no_build=True)
Expand Down
2 changes: 1 addition & 1 deletion tools/system_libs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1227,8 +1227,8 @@ def get_files(self):
'stdlib_typeinfo.cpp',
'private_typeinfo.cpp',
'cxa_exception_emscripten.cpp',
'gxx_personality_stub.cpp',
]
print("HI!")
if self.eh_mode == Exceptions.NONE:
filenames += ['cxa_noexception.cpp']
elif self.eh_mode == Exceptions.WASM:
Expand Down