Stream: general

Topic: Rust 1.91.0 Linking Regression with wasm_import_module...


view this post on Zulip Paul Osborne (Oct 31 2025 at 21:50):

Posting this here in case it impacts others -- with the 1.91.0 update, we ran into link errors (and runtime errors with LTO enabled) due to what appears to be a regression in Rustc.

I've written up an issue https://github.com/rust-lang/rust/issues/148347 and have a minimal repro with some additional notes here: https://github.com/posborne/rustc-1.91.0-wasm-linkage-bug-repro

The main case that seem to be impacted is usage of #[link(wasm_import_module = "test")] defs with link_names that match those exported by libc.

This results in errors like this if LTO is disabled:

  = note: rust-lld: error: import module mismatch for symbol: close
          >>> defined as env in /home/paul.osborne/Projects/OpenSource/rustc-bug-wasm-mangling-minrepro/target/wasm32-wasi
p1/release/deps/standalone_repro.standalone_repro.10d18315a1d024f1-cgu.1.rcgu.o
          >>> defined as test in /home/paul.osborne/Projects/OpenSource/rustc-bug-wasm-mangling-minrepro/target/wasm32-was
ip1/release/deps/standalone_repro.standalone_repro.10d18315a1d024f1-cgu.3.rcgu.o

With LTO enabled, linking "succeeds" but emits incorrect code that traps at runtime (for the cases we ran into, at signature validation checks).

Additional notes and repro cases: https://github.com/posborne/rustc-1.91.0-wasm-linkage-bug-repro With the Rust 1.91.0 stable update, it appears that a regression has been introduced which causes l...
Repro and notes for apparent rustc defect in 1.91.0 - posborne/rustc-1.91.0-wasm-linkage-bug-repro

view this post on Zulip Paul Osborne (Nov 10 2025 at 21:43):

A new stable release 1.91.1 with a fix for this issue backported is available in 1.91.1. Thank you @bjorn3 and @Alex Crichton

https://blog.rust-lang.org/2025/11/10/Rust-1.91.1/

Empowering everyone to build reliable and efficient software.

Last updated: Dec 06 2025 at 05:03 UTC