From 3fb6d45af9c9e8a682da743f6d920bb5b6dd66de Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Wed, 15 Jun 2022 12:33:27 -0700 Subject: [PATCH] ENH Move --memory-init-file flag from EmLinker to asmjs target spec --- compiler/rustc_codegen_ssa/src/back/linker.rs | 2 -- .../rustc_target/src/spec/asmjs_unknown_emscripten.rs | 10 +++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/compiler/rustc_codegen_ssa/src/back/linker.rs b/compiler/rustc_codegen_ssa/src/back/linker.rs index ee097b5f051..8ac5f094cf6 100644 --- a/compiler/rustc_codegen_ssa/src/back/linker.rs +++ b/compiler/rustc_codegen_ssa/src/back/linker.rs @@ -1120,8 +1120,6 @@ impl<'a> Linker for EmLinker<'a> { OptLevel::Size => "-Os", OptLevel::SizeMin => "-Oz", }); - // Unusable until https://github.com/rust-lang/rust/issues/38454 is resolved - self.cmd.args(&["--memory-init-file", "0"]); } fn pgo_gen(&mut self) { diff --git a/compiler/rustc_target/src/spec/asmjs_unknown_emscripten.rs b/compiler/rustc_target/src/spec/asmjs_unknown_emscripten.rs index a90c7b7bc6f..269bf8b8bcd 100644 --- a/compiler/rustc_target/src/spec/asmjs_unknown_emscripten.rs +++ b/compiler/rustc_target/src/spec/asmjs_unknown_emscripten.rs @@ -2,10 +2,10 @@ use super::{wasm32_unknown_emscripten, LinkerFlavor, Target}; pub fn target() -> Target { let mut target = wasm32_unknown_emscripten::target(); - target - .post_link_args - .entry(LinkerFlavor::Em) - .or_default() - .extend(vec!["-s".into(), "WASM=0".into()]); + target.post_link_args.entry(LinkerFlavor::Em).or_default().extend(vec![ + "-sWASM=0".into(), + "--memory-init-file".into(), + "0".into(), + ]); target }