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
$ emcc --version
emcc (Emscripten gcc/clang-like replacement) 1.39.1 (commit 1b1f08f356d3f10d91e50c09dda6d44372ca908c)
Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt)
This is free and open source software under the MIT license.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I am attempting to upgrade the toolchain of a Rust and C project to Rust nightly's support for the LLVM emscripten backend #63649.
The project has a crate that compiles a C static library. The C library depends on symbols that are exported from Rust code in the crate as no_mangle and pub unsafe extern "C".
The build preamble sets RUSTFLAGS to enable building Wasm with emcc and marks all of the Rust symbols as exported.
The C static library has a macro for injecting an extern like modifier. The build.rs defines this macro to be __attribute__((used)) to match the EMSCRIPTEN_KEEPALIVE macro.
This code compiles and links, but when the application attempts to call a Rust exported symbol from C, Chrome raises a runtime error saying the function is unreachable.
VM5097:10526 Uncaught RuntimeError: unreachable
at unreachable:artichoke_ary_push (wasm-function[50]:0x58b7)
at hash_vals_i (wasm-function[7079]:0x32fba8)
at ht_foreach (wasm-function[7039]:0x32a4a0)
at mrb_hash_values (wasm-function[7078]:0x32faa5)
at dynCall_viii (wasm-function[11266]:0x48ac54)
at Module.dynCall_viii (eval at module.exports (webpack:///../node_modules/script-loader/addScript.js?), <anonymous>:10366:40)
at invoke_viii (eval at module.exports (webpack:///../node_modules/script-loader/addScript.js?), <anonymous>:10523:5)
at mrb_vm_exec (wasm-function[6396]:0x29d490)
at mrb_vm_run (wasm-function[6386]:0x25f3b4)
at mrb_top_run (wasm-function[6412]:0x2a84bc)
This function is explicitly exported and linking succeeds.
I'm not sure what is going on here. Any ideas?
The text was updated successfully, but these errors were encountered:
Are you sure the unreachable means that the function is missing? It looks to me like it was called without problems, and then raised an exception with the text "unreachable". The artichoke_ary_push function is here:
Thanks for taking a look Jonas. There is some UB and segfaults going on in this bit of code. I’ve decided to abandon this investigation and instead will focus on removing my dependency on the mruby C code.
I am attempting to upgrade the toolchain of a Rust and C project to Rust nightly's support for the LLVM emscripten backend #63649.
The project has a crate that compiles a C static library. The C library depends on symbols that are exported from Rust code in the crate as
no_mangle
andpub unsafe extern "C"
.The build preamble sets
RUSTFLAGS
to enable building Wasm with emcc and marks all of the Rust symbols as exported.The C static library has a macro for injecting an
extern
like modifier. Thebuild.rs
defines this macro to be__attribute__((used))
to match theEMSCRIPTEN_KEEPALIVE
macro.This code compiles and links, but when the application attempts to call a Rust exported symbol from C, Chrome raises a runtime error saying the function is unreachable.
This function is explicitly exported and linking succeeds.
I'm not sure what is going on here. Any ideas?
The text was updated successfully, but these errors were encountered: