pyodide/emsdk/patches/0003-Fix-side-module-except...

35 lines
1.2 KiB
Diff

From 73b89ee1b5a57c65824baf91b547be32b69decbd Mon Sep 17 00:00:00 2001
From: Hood Chatham <roberthoodchatham@gmail.com>
Date: Tue, 15 Feb 2022 23:27:03 -0500
Subject: [PATCH 3/4] Fix side module exception handling
See https://github.com/emscripten-core/emscripten/pull/16309
Apparently compiled C++ code tries to call a bunch of functions with names like
`__cxa_find_matching_catch_##` which all mean the same function. Emscripten
statically defines the set of these that are used in the main module, but it is
possible that a side module will need extra ones. This fixes the problem by updating
`resolveGlobalSymbol` so that every `__cxa_find_matching_catch_##` will resolve to
`__cxa_find_matching_catch`.
---
src/library_dylink.js | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/library_dylink.js b/src/library_dylink.js
index 54a6f190c..1d1613eef 100644
--- a/src/library_dylink.js
+++ b/src/library_dylink.js
@@ -32,6 +32,9 @@ var LibraryDylink = {
sym = createInvokeFunction(symName.split('_')[1]);
}
+ if(!sym && symName.startsWith("__cxa_find_matching_catch")){
+ sym = Module.___cxa_find_matching_catch;
+ }
return sym;
},
--
2.25.1