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).
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/
Last updated: Dec 06 2025 at 05:03 UTC