rust-lang / rust-lang/rust

`wasm32v1-none` still creates incorrect object files

Open
#145,491 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug O-wasm T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

@alexcrichton

I thought this had been fixed in #145275. But it seems that the problem still exists.

foo.rs

#![no_core]
#![crate_type = "cdylib"]
#![feature(no_core)]
rustc +nightly-2025-08-16 foo.rs --target wasm32v1-none -C linker-plugin-lto=on && wasm-dis foo.wasm
(module $foo.wasm
 (import "env" "memory" (memory $mimport$0 16))
 (global $__stack_pointer (mut i32) (i32.const 1048576))
 (global $global$1 i32 (i32.const 1048576))
 (global $global$2 i32 (i32.const 1048576))
 (export "__data_end" (global $global$1))
 (export "__heap_base" (global $global$2))
 ;; custom section "producers", size 59
 ;; features section: mutable-globals, nontrapping-float-to-int, bulk-memory, sign-ext, reference-types, multivalue
)

target_features should not have anything other than mutable-globals: https://doc.rust-lang.org/rustc/platform-support/wasm32v1-none.html#enabled-webassembly-features

Meta

rustc +nightly-2025-08-16 --version --verbose:

rustc 1.91.0-nightly (cd7cbe818 2025-08-15)
binary: rustc
commit-hash: cd7cbe818e4a66d46fe2df993d1b8518eba8a5cd
commit-date: 2025-08-15
host: x86_64-unknown-linux-gnu
release: 1.91.0-nightly
LLVM version: 21.1.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the shown rustc command and inspect foo.wasm with wasm-dis. Start by tracing how the wasm32v1-none target features are selected during compilation and linking. Done means the generated features section contains only mutable-globals, while the provided no_core example still compiles successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, wasm
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.