Many new wasm features are enabled if compile wasm32v1-none
with -C linker-plugin-lto
flag on LLVM 20+
#140174
Labels
A-linkers
Area: linkers... you gotta love linkers
A-LLVM
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
A-LTO
Area: Link-time optimization (LTO)
C-bug
Category: This is a bug.
E-needs-mcve
Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
O-wasm
Target: WASM (WebAssembly), http://webassembly.org/
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
@alexcrichton
Code is minimized as much as possible and here is demo repository: https://github.com/StackOverflowExcept1on/wasm-builder-regression/
wasm-checker
- simple CLI tool that passes wasm to parity-wasm parser (it does not support new wasm features like reference-types, bulk-memory)wasm-program
- this is smart contract that just allocates vectorwasm-project
- some intermediate directory that is generated by our utilitygit clone https://github.com/StackOverflowExcept1on/wasm-builder-regression.git cd wasm-builder-regression/wasm-project cargo clean ./check.sh
opcode 252 is
memory.fill
(bulk memory operations)target was
wasm32v1-none
, however here we see bunch of wasm features that shouldn't be here.I've also added LLVM IR output so we can report this bug to LLVM as soon as possible:
If I remove flag
-C linker-plugin-lto
, it works as expectedI expected to see this happen: I can use
-C linker-plugin-lto
to optimize my .wasm programs and it results in generating the correct code for thewasm32v1-none
targetInstead, this happened: there is some kind of conflict between compiler flags?
Version it worked on
Problems started after #135763. I don't have time to bisect exact version right now.
Version with regression
rustc +nightly-2025-04-22 --version --verbose
:The text was updated successfully, but these errors were encountered: