Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Commit

Permalink
Receive EMULATED_FUNCTION_POINTER_CASTS (#233)
Browse files Browse the repository at this point in the history
We did not handle this properly before, without this option, we looked at the similarly-named function pointer emulation flag.

Matched with emscripten-core/emscripten#7318
  • Loading branch information
kripken committed Oct 23, 2018
1 parent 7007970 commit 1af410b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/Target/JSBackend/JSBackend.cpp
Expand Up @@ -98,6 +98,11 @@ EmulatedFunctionPointers("emscripten-emulated-function-pointers",
cl::desc("Emulate function pointers, avoiding asm.js function tables (see emscripten EMULATED_FUNCTION_POINTERS option)"),
cl::init(false));

static cl::opt<bool>
EmulateFunctionPointerCasts("emscripten-emulate-function-pointer-casts",
cl::desc("Emulate function pointers casts, handling extra or ignored parameters (see emscripten EMULATE_FUNCTION_POINTER_CASTS option)"),
cl::init(false));

static cl::opt<int>
EmscriptenAssertions("emscripten-assertions",
cl::desc("Additional JS-specific assertions (see emscripten ASSERTIONS)"),
Expand Down Expand Up @@ -3409,7 +3414,7 @@ void JSWriter::printFunctionBody(const Function *F) {
// use a simple i64-based ABI for everything, using function pointers for dlsym etc. (otherwise, if we used an
// export which is callable by JS - not using the i64 ABI - that would not be a proper function pointer for
// a wasm->wasm call).
if (WebAssembly && EmulatedFunctionPointers) {
if (WebAssembly && EmulateFunctionPointerCasts) {
getFunctionIndex(F);
}
}
Expand Down

0 comments on commit 1af410b

Please sign in to comment.