Repository navigation
Link failure with -sWASMFS -flto=thin #27939
Copy link
Copy link
Open
Description
Version of emscripten/emsdk:
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 6.0.11 (a0014542110d6078c3a1a7941fa1ddb3a2281f16)
clang version 24.0.0git (https:/github.com/llvm/llvm-project f718ebe873411a562ef6e5c27da36d75b7aaec98)
Target: wasm32-unknown-emscripten
Thread model: posix
Failing command line in full:
Use the reproducer:
#include <unistd.h>
int main(int argc, char **argv) {
fsync(0);
fdatasync(0);
return 0;
}Link with:
emcc -sWASMFS -flto=thin minimal.c -o minimal.js
Result:
wasm-ld: error: import module mismatch for symbol: __wasi_fd_sync
>>> defined as env in /home/paradust/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/thinlto/libwasmfs-debug.a(syscalls.o)
>>> defined as wasi_snapshot_preview1 in /home/paradust/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/thinlto/minimal.wasm.lto.libc-debug.a(fsync.o at 2366516).o
emcc: error: '/home/paradust/emsdk/upstream/bin/wasm-ld -o minimal.wasm /tmp/tmp_mszapyplibemscripten_js_symbols.so -Bstatic --strip-debug -u__cxa_atexit --export=emscripten_stack_get_end --export=emscripten_stack_get_free --export=emscripten_stack_get_base --export=emscripten_stack_get_current --export=emscripten_stack_init --export=wasmfs_flush --export=_emscripten_stack_alloc --export=setThrew --export=__wasm_call_ctors --export=_emscripten_stack_restore --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__start_em_lib_deps --export-if-defined=__stop_em_lib_deps --export-if-defined=__start_em_js --export-if-defined=__stop_em_js --export-if-defined=main --export-if-defined=__main_argc_argv --export-if-defined=fflush --export-table -z stack-size=65536 --no-growable-memory --initial-heap=16777216 --no-entry --stack-first --table-base=1 /tmp/emscripten_temp_8xy2kcjf/minimal.o -L/home/paradust/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/thinlto -L/home/paradust/emsdk/upstream/emscripten/src/lib -lGL-getprocaddr -lal -lhtml5 -lstubs-debug -lnoexit -lc-debug -ldlmalloc-debug -lclang_rt.builtins -lc++-debug-noexcept -lc++abi-debug-noexcept -lsockets -lwasmfs_no_fs -lwasmfs-debug -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr' failed (returned 1)
Omitting either flag results in a successful compile.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity