about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2022-09-29 10:15:18 -0700
committerGitHub <noreply@github.com>2022-09-29 10:15:18 -0700
commit3cecc78694869d05ea0947780bcd5cbd9035504b (patch)
tree1a26661b7c8e2795c54846b890686fd6d0d03c92
parent0878bee38adbc06b0f70664a1924bf3a09922338 (diff)
parent284c94257fbf32e62bbe3a8f9e71ecb644763df9 (diff)
downloadrust-3cecc78694869d05ea0947780bcd5cbd9035504b.tar.gz
rust-3cecc78694869d05ea0947780bcd5cbd9035504b.zip
Rollup merge of #102426 - sunfishcode:sunfishcode/no-wasm-init-memory, r=nagisa
Don't export `__wasm_init_memory` on WebAssembly.

Since #72889, the Rust wasm target doesn't use --passive-segments, so remove the `--export=__wasm_init_memory`.

As documented in the [tool-conventions Linking convention], `__wasm_init_memory` is not intended to be exported.

[tool-conventions Linking convention]: https://github.com/WebAssembly/tool-conventions/blob/7c064f304858f67ebf22964a84b7e9658e29557a/Linking.md#shared-memory-and-passive-segments
-rw-r--r--compiler/rustc_codegen_ssa/src/back/linker.rs6
1 files changed, 0 insertions, 6 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/linker.rs b/compiler/rustc_codegen_ssa/src/back/linker.rs
index 061053ef2ac..f59a753a5ce 100644
--- a/compiler/rustc_codegen_ssa/src/back/linker.rs
+++ b/compiler/rustc_codegen_ssa/src/back/linker.rs
@@ -1180,18 +1180,12 @@ impl<'a> WasmLd<'a> {
         //   sharing memory and instantiating the module multiple times. As a
         //   result if it were exported then we'd just have no sharing.
         //
-        // * `--export=__wasm_init_memory` - when using `--passive-segments` the
-        //   linker will synthesize this function, and so we need to make sure
-        //   that our usage of `--export` below won't accidentally cause this
-        //   function to get deleted.
-        //
         // * `--export=*tls*` - when `#[thread_local]` symbols are used these
         //   symbols are how the TLS segments are initialized and configured.
         if sess.target_features.contains(&sym::atomics) {
             cmd.arg("--shared-memory");
             cmd.arg("--max-memory=1073741824");
             cmd.arg("--import-memory");
-            cmd.arg("--export=__wasm_init_memory");
             cmd.arg("--export=__wasm_init_tls");
             cmd.arg("--export=__tls_size");
             cmd.arg("--export=__tls_align");