Skip to content

Can not disable reference-types feature for wasm32 target with -C linker-plugin-lto flag #130604

@StackOverflowExcept1on

Description

@StackOverflowExcept1on

Code

@alexcrichton

Code is minimized as much as possible and here is a 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 reference-types)
  • wasm-program - this is smart contract that panics and terminates with an error
  • wasm-project - some intermediate directory that is generated by our utility
  • check.sh source code
git clone https://github.com/StackOverflowExcept1on/wasm-builder-regression.git cd wasm-builder-regression/wasm-project ./check.sh
 Finished `release` profile [optimized] target(s) in 8.30s Compiling gear-wasm v0.45.1 Compiling wasm-checker v0.1.0 (/mnt/tmpfs/wasm-builder-regression/wasm-checker) Finished `release` profile [optimized] target(s) in 1.68s Running `/mnt/tmpfs/wasm-builder-regression/wasm-checker/target/release/wasm-checker ./target/wasm32-unknown-unknown/release/wasm_program.wasm` Error: InvalidTableReference(128) 

If I remove flag -C linker-plugin-lto, it works as described in #128511

I expected to see this happen: I can disable reference-types via -Ctarget-cpu=mvp and -Zbuild-std

Instead, this happened: there is some kind of conflict between compiler flags?

Version it worked on

It most recently worked on: nightly-2024-07-31

Version with regression

rustc +nightly-2024-08-01 --version --verbose:

rustc 1.82.0-nightly (28a58f2fa 2024-07-31) binary: rustc commit-hash: 28a58f2fa7f0c46b8fab8237c02471a915924fe5 commit-date: 2024-07-31 host: x86_64-unknown-linux-gnu release: 1.82.0-nightly LLVM version: 19.1.0 

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.O-wasmTarget: WASM (WebAssembly), http://webassembly.org/P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-untriagedUntriaged performance or correctness regression.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions