Changes to WebAssembly targets and handling undefined symbols
Rust's WebAssembly targets are soon going to experience a change which has a risk of breaking existing projects. The --allow-undefined flag is being removed from wasm-ld, which will change how undefined symbols are handled in WebAssembly targets. This change may break existing projects and is considered substantive breaking news. The --allow-undefined flag was passed to wasm-ld to allow undefined symbols in linked binaries. However, this flag is being removed to make WebAssembly targets behave more like native platforms. Users who are intentionally relying on this behavior can fix their code by using a #[link] attribute to explicitly specify the wasm_import_module name. Affected users can also compile with -Clink-arg=--allow-undefined to quickly restore the old behavior. The change is expected to land in nightly soon and will be released with Rust 1.96 on 2026-05-28. If users encounter any issues as a result of this change, they can file an issue on the Rust GitHub page. To prepare for this change, users should review their code and update it to use the new behavior. They can also test their code with the new behavior by compiling with -Clink-arg=--allow-undefined. By doing so, users can ensure a smooth transition to the new behavior and avoid any potential issues.