Many new wasm features are enabled if compile wasm32v1-none
with -C linker-plugin-lto
flag on LLVM 20+
#140174
Labels
C-bug
Category: This is a bug.
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
O-wasm
Target: WASM (WebAssembly), http://webassembly.org/
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: