From e665bb4c3dc735a2b46851656e633332b964e259 Mon Sep 17 00:00:00 2001 From: Vyacheslav Chigrin Date: Thu, 10 Jul 2025 12:19:50 +0300 Subject: [PATCH 1/2] Fix unresolved symbol in standalone debug build. --- system/lib/standalone/standalone.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/system/lib/standalone/standalone.c b/system/lib/standalone/standalone.c index 3a910ba662d62..fdca8d949fa3f 100644 --- a/system/lib/standalone/standalone.c +++ b/system/lib/standalone/standalone.c @@ -25,6 +25,7 @@ #include "lock.h" #include "emscripten_internal.h" +#include "unwind.h" /* * WASI support code. These are compiled with the program, and call out @@ -308,3 +309,7 @@ weak void _emscripten_get_progname(char* buf, int length) { } weak void _emscripten_runtime_keepalive_clear() {} + +void __throw_exception_with_stack_trace(_Unwind_Exception* exception_object) { + _Unwind_RaiseException(exception_object); +} From 38c31db5759c7fe24cc9941d2ad17dbbaa6bbc9a Mon Sep 17 00:00:00 2001 From: Vyacheslav Chigrin Date: Fri, 11 Jul 2025 15:05:09 +0300 Subject: [PATCH 2/2] Add test for standalone binary imports. --- test/test_other.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/test_other.py b/test/test_other.py index cf6a3c418c591..39b0ed4bf6086 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -15182,6 +15182,15 @@ def test_standalone_settings(self): err = self.expect_fail(base_cmd + ['-sMEMORY_GROWTH_LINEAR_STEP=1mb']) self.assertContained('error: MEMORY_GROWTH_LINEAR_STEP is not compatible with STANDALONE_WASM', err) + def test_standalone_imports(self): + # Ensure standalone binary will not have __throw_exception_with_stack_trace + # debug helper dependency, caused by exception-related code. + src_path = test_file('core/test_exceptions.cpp') + self.run_process([EMXX, '-O0', '-fwasm-exceptions', '-sSTANDALONE_WASM', src_path]) + imports = self.parse_wasm('a.out.wasm')[0] + for name in imports: + self.assertTrue(name.startswith('wasi_'), 'Unexpected import %s' % name) + @is_slow_test def test_googletest(self): # TODO(sbc): Should we package gtest as an emscripten "port"? I guess we should if