Skip to content

Add back in __gxx_personality_v0 #17222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jun 16, 2022
7 changes: 0 additions & 7 deletions src/library.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,13 +405,6 @@ mergeInto(LibraryManager.library, {
abort('Assertion failed: ' + UTF8ToString(condition) + ', at: ' + [filename ? UTF8ToString(filename) : 'unknown filename', line, func ? UTF8ToString(func) : 'unknown function']);
},

// TODO: Remove this when Rust doesn't need it anymore.
// https://github.com/rust-lang/rust/pull/97888
__gxx_personality_v0: function() {
console.warn("__gxx_personality_v0 called", arguments);
abort("__gxx_personality_v0 called");
},

// ==========================================================================
// time.h
// ==========================================================================
Expand Down
20 changes: 20 additions & 0 deletions system/lib/libcxxabi/src/gxx_personality_stub.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <stdint.h>
#include <stdlib.h>


#include "cxa_exception.h"
#include "cxa_handlers.h"
#include "emscripten.h"



// 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();
}
11 changes: 6 additions & 5 deletions tests/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -12130,15 +12130,16 @@ def test_print_map(self):
def test_rust_gxx_personality_v0(self):
create_file('main.cpp', r'''
#include <stdio.h>
#include <stdint.h>
extern "C" {
void __gxx_personality_v0();
void rust_eh_personality(){
__gxx_personality_v0();
int __gxx_personality_v0(int version, void* actions, uint64_t exception_class, void* exception_object, void* context);
int rust_eh_personality(int version, void* actions, uint64_t exception_class, void* exception_object, void* context){
return __gxx_personality_v0(version, actions, exception_class, exception_object, context);
}
int main(int argc, char** argv) {
printf("result: %d\n", argc);
if(argc == 2){
rust_eh_personality();
rust_eh_personality(0, NULL, 0, NULL, NULL);
}
return 0;
}
Expand All @@ -12154,5 +12155,5 @@ def test_rust_gxx_personality_v0(self):
raise RuntimeError('should not have passed')
except AssertionError as e:
err = e
assert "__gxx_personality_v0 called" in err.args[0]
assert "Aborted(native code called abort())" in err.args[0]
del err
1 change: 1 addition & 0 deletions tools/system_libs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1227,6 +1227,7 @@ def get_files(self):
'stdlib_typeinfo.cpp',
'private_typeinfo.cpp',
'cxa_exception_emscripten.cpp',
'gxx_personality_stub.cpp',
]
if self.eh_mode == Exceptions.NONE:
filenames += ['cxa_noexception.cpp']
Expand Down