You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Wasm generated by LLVM is corrupted, and wasm-opt, wasm-validate etc fail:
$ emcc temp.c -O -Wl,--allow-undefined
[parse exception: attempted pop from empty stack / beyond block start boundary at 262 (at 0:262)]
Fatal: error in parsing input
emcc: error: '/home/rreverser/emsdk/upstream/bin/wasm-emscripten-finalize --dyncalls-i64 --pass-arg=legalize-js-interface-exported-helpers a.out.wasm -o a.out.wasm --detect-features' failed (returned 1)
As discussed in linked issues, this is likely due to maybe_func being called directly without bitcast handling that Wasm function pointers require. IIUC this is not possible to solve in general for arbitrary casts, but should be doable for extern symbols.
The text was updated successfully, but these errors were encountered:
When selecting calls, currently we unconditionally remove `Wrapper`s of
the call target. But we are supposed to do that only when the target is
a function, an external symbol (= library function), or an alias of a
function. Otherwise we end up directly calling globals that are not
functions.
Fixesllvm#60003.
Reviewed By: tlively, HerrCai0907
Differential Revision: https://reviews.llvm.org/D147397
DianQK
pushed a commit
to DianQK/llvm-project
that referenced
this issue
Oct 10, 2023
When selecting calls, currently we unconditionally remove `Wrapper`s of
the call target. But we are supposed to do that only when the target is
a function, an external symbol (= library function), or an alias of a
function. Otherwise we end up directly calling globals that are not
functions.
Fixesllvm#60003.
Reviewed By: tlively, HerrCai0907
Differential Revision: https://reviews.llvm.org/D147397
Original issue in emscripten-core/emscripten#15722 / rust-lang/rust#91628.
The minimal repro for C/C++ looks like this:
This produces the following LLVM IR with
-target wasm32-unknown-emscripten
(but likely reproducible with other Wasm targets too):The Wasm generated by LLVM is corrupted, and
wasm-opt
,wasm-validate
etc fail:As discussed in linked issues, this is likely due to
maybe_func
being called directly without bitcast handling that Wasm function pointers require. IIUC this is not possible to solve in general for arbitrary casts, but should be doable for extern symbols.The text was updated successfully, but these errors were encountered: