Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions system/lib/libcxxabi/src/cxa_noexception.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ void __cxa_free_exception(void *thrown_object) throw() {
((char *)cxa_exception_from_thrown_object(thrown_object));
free((void *)raw_buffer);
}

__cxa_exception*
__cxa_init_primary_exception(void* object,
std::type_info* tinfo,
void*(_LIBCXXABI_DTOR_FUNC* dest)(void*)) throw() {
__cxa_exception* exception_header = cxa_exception_from_thrown_object(object);
return exception_header;
}
#endif

} // extern "C"
Expand Down
20 changes: 20 additions & 0 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -14891,3 +14891,23 @@ def test_mimalloc_headers(self):
def test_SUPPORT_BIG_ENDIAN(self):
# Just a simple build-only test for now
self.run_process([EMCC, '-sSUPPORT_BIG_ENDIAN', test_file('hello_world.c')])

@parameterized({
'noexcept': ['-fno-exceptions'],
'default': [],
'except': ['-sDISABLE_EXCEPTION_CATCHING=0'],
'except_wasm': ['-fwasm-exceptions'],
'except_wasm_exnref': ['-fwasm-exceptions', '-sWASM_EXNREF']
})
def test_std_promise_link(self, *args):
# Regression test for a bug where std::promise's destructor caused a link
# error with __cxa_init_primary_exception when no exception argument was
# given (which defaults to -fignore-exceptions)
create_file('src.cpp', r'''
#include <future>
int main() {
std::promise<int> p;
return 0;
}
''')
self.run_process([EMXX, 'src.cpp', '-pthread'] + list(args))