Skip to content

Commit e7da81d

Browse files
authored
Handle both emscripten_longjmp and emscripten_longjmp_jmpbuf (#12157)
The longer name appears from the wasm backend, and wasm-emscripten-finalize renames it. Instead, support both, and then we can remove the long name either in LLVM or in binaryen. See WebAssembly/binaryen#3043
1 parent fb1acd4 commit e7da81d

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/library.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1788,14 +1788,13 @@ LibraryManager.library = {
17881788
// ==========================================================================
17891789

17901790
#if SUPPORT_LONGJMP
1791+
longjmp__sig: 'vii',
17911792
longjmp: function(env, value) {
17921793
_setThrew(env, value || 1);
17931794
throw 'longjmp';
17941795
},
1795-
emscripten_longjmp__deps: ['longjmp'],
1796-
emscripten_longjmp: function(env, value) {
1797-
_longjmp(env, value);
1798-
},
1796+
emscripten_longjmp: 'longjmp',
1797+
emscripten_longjmp_jmpbuf: 'longjmp',
17991798
#endif
18001799

18011800
// ==========================================================================

tools/wasm2c/base.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ IMPORT_IMPL(void, Z_envZ_emscripten_longjmpZ_vii, (u32 buf, u32 value), {
131131
longjmp(setjmp_stack[next_setjmp - 1], 1);
132132
});
133133

134+
IMPORT_IMPL(void, Z_envZ_emscripten_longjmp_jmpbufZ_vii, (u32 buf, u32 value), {
135+
return Z_envZ_emscripten_longjmpZ_vii(buf, value);
136+
});
137+
134138
IMPORT_IMPL(void, Z_envZ_emscripten_notify_memory_growthZ_vi, (u32 size), {});
135139

136140
static u32 tempRet0 = 0;

0 commit comments

Comments
 (0)