-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Description
Continuing the discussion from llvm/llvm-project#55786 xref rust-lang/rust#80775, xref pyodide/pyodide#2378.
Rust libraries contain a lib.rmeta
file and must be linked with --no-whole-archive
. When I try to build rust libraries targeting wasm32-unknown-emscripten
I run into linker errors because the rust libraries are being loaded with --whole-archive
set.
I think that emscripten is indeed the culprit here:
Line 363 in 2aa89c2
if settings.LINKABLE: |
# Emscripten currently expects linkable output (SIDE_MODULE/MAIN_MODULE) to
# include all archive contents.
if settings.LINKABLE:
args.insert(0, '--whole-archive')
args.append('--no-whole-archive')
We probably need a separate setting to disable this.
Response file with problematic linker args
root:WARNING: Creating response file /tmp/emscripten_w2dsyqtv.rsp with following contents: -o
/src/packages/cryptography/build/cryptography-36.0.2/src/rust/target/wasm32-unknown-emscripten/release/deps/cryptography_rust.wasm
--whole-archive
<... tons of files, some of which require --no-whole-archive>
-lc
-L/src/.docker_home/.rustup/toolchains/nightly-2022-05-28-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-emscripten/lib
-L/src/.docker_home/.rustup/toolchains/nightly-2022-05-28-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-emscripten/lib/self-contained
--fatal-warnings
-L/src/emsdk/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic
--no-whole-archive
-mllvm
-combiner-global-alias-analysis=false
-mllvm
-enable-emscripten-cxx-exceptions
-mllvm
-enable-emscripten-sjlj
-mllvm
-disable-lsr
--import-undefined
--import-memory
--strip-debug
--export-all
--no-gc-sections
--experimental-pic
-shared
Metadata
Metadata
Assignees
Labels
No labels