diff --git a/compiler/rustc_target/src/spec/targets/wasm32v1_none.rs b/compiler/rustc_target/src/spec/targets/wasm32v1_none.rs index e554e2ac07680..63a785a35b66c 100644 --- a/compiler/rustc_target/src/spec/targets/wasm32v1_none.rs +++ b/compiler/rustc_target/src/spec/targets/wasm32v1_none.rs @@ -29,6 +29,11 @@ pub(crate) fn target() -> Target { // For now this target just never has an entry symbol no matter the output // type, so unconditionally pass this. "--no-entry", + // It is also necessary to explicitly set CPU and features since some changes + // were made to WebAssembly starting with LLVM 20.1.0: + // https://releases.llvm.org/20.1.0/docs/ReleaseNotes.html#changes-to-the-webassembly-backend + "--mllvm=-mcpu=mvp", + "--mllvm=-mattr=+mutable-globals", ], ); options.add_pre_link_args( @@ -37,7 +42,7 @@ pub(crate) fn target() -> Target { // Make sure clang uses LLD as its linker and is configured appropriately // otherwise "--target=wasm32-unknown-unknown", - "-Wl,--no-entry", + "-Wl,--no-entry,--mllvm=-mcpu=mvp,--mllvm=-mattr=+mutable-globals", ], );