rustc: Fix wasm64 metadata object files

It looks like LLD will detect object files being either 32 or 64-bit
depending on any memory present. LLD will additionally reject 32-bit
objects during a 64-bit link. Previously metadata objects did not have
any memories in them which led LLD to conclude they were 32-bit objects
which broke 64-bit targets for wasm.

This commit fixes this by ensuring that for 64-bit targets there's a
memory object present to get LLD to detect it's a 64-bit target.
Additionally this commit moves away from a hand-crafted wasm encoder to
the `wasm-encoder` crate on crates.io as the complexity grows for the
generated object file.

Closes #121460
This commit is contained in:
Alex Crichton 2024-02-22 08:12:09 -08:00
parent 2dbd6233cc
commit 646e8e7291
5 changed files with 59 additions and 49 deletions

View file

@ -38,6 +38,7 @@ tempfile = "3.2"
thin-vec = "0.2.12"
thorin-dwp = "0.7"
tracing = "0.1"
wasm-encoder = "0.200.0"
# tidy-alphabetical-end
[target.'cfg(unix)'.dependencies]