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

Commit 1af410b

Browse files
authored
Receive EMULATED_FUNCTION_POINTER_CASTS (#233)
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
1 parent 7007970 commit 1af410b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/Target/JSBackend/JSBackend.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ EmulatedFunctionPointers("emscripten-emulated-function-pointers",
9898
cl::desc("Emulate function pointers, avoiding asm.js function tables (see emscripten EMULATED_FUNCTION_POINTERS option)"),
9999
cl::init(false));
100100

101+
static cl::opt<bool>
102+
EmulateFunctionPointerCasts("emscripten-emulate-function-pointer-casts",
103+
cl::desc("Emulate function pointers casts, handling extra or ignored parameters (see emscripten EMULATE_FUNCTION_POINTER_CASTS option)"),
104+
cl::init(false));
105+
101106
static cl::opt<int>
102107
EmscriptenAssertions("emscripten-assertions",
103108
cl::desc("Additional JS-specific assertions (see emscripten ASSERTIONS)"),
@@ -3409,7 +3414,7 @@ void JSWriter::printFunctionBody(const Function *F) {
34093414
// use a simple i64-based ABI for everything, using function pointers for dlsym etc. (otherwise, if we used an
34103415
// export which is callable by JS - not using the i64 ABI - that would not be a proper function pointer for
34113416
// a wasm->wasm call).
3412-
if (WebAssembly && EmulatedFunctionPointers) {
3417+
if (WebAssembly && EmulateFunctionPointerCasts) {
34133418
getFunctionIndex(F);
34143419
}
34153420
}

0 commit comments

Comments
 (0)