Skip to content

Commit

Permalink
Document some emsdk patches (pyodide#863)
Browse files Browse the repository at this point in the history
  • Loading branch information
dalcde authored and joemarshall committed Jan 3, 2021
1 parent 42c53ac commit 6391a75
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions emsdk/patches/emulate_pointer.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
This fixes an upstream bug introduced in emscripten 1.38.34 that causes dlsym
to always return 0 for function pointers when EMULATE_FUNCTION_POINTER_CASTS is
enabled. This is a simple typo, since `mangled == "_" + symbol`. This piece of
code is no longer present in upstream master, hence there is no effort to
upstream the fix.

diff --git a/emsdk/fastcomp/emscripten/src/library.js b/emsdk/fastcomp/emscripten/src/library.js
index 97cca10..5c002d7 100644
--- a/emsdk/fastcomp/emscripten/src/library.js
+++ b/emsdk/fastcomp/emscripten/src/library.js
@@ -2194,7 +2194,7 @@ LibraryManager.library = {
// can call (which does not use that ABI), as the function pointer would
// not be usable from wasm. instead, the wasm has exported function pointers
// for everything we need, with prefix fp$, use those
- result = lib.module['fp$' + symbol];
+ result = lib.module['fp$' + mangled];
if (typeof result === 'object') {
// a breaking change in the wasm spec, globals are now objects
// https://github.com/WebAssembly/mutable-global/issues/1

0 comments on commit 6391a75

Please sign in to comment.