Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3cecc78

Browse files
authoredSep 29, 2022
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
2 parents 0878bee + 284c942 commit 3cecc78

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed
 

‎compiler/rustc_codegen_ssa/src/back/linker.rs

-6
Original file line numberDiff line numberDiff line change
@@ -1180,18 +1180,12 @@ impl<'a> WasmLd<'a> {
11801180
// sharing memory and instantiating the module multiple times. As a
11811181
// result if it were exported then we'd just have no sharing.
11821182
//
1183-
// * `--export=__wasm_init_memory` - when using `--passive-segments` the
1184-
// linker will synthesize this function, and so we need to make sure
1185-
// that our usage of `--export` below won't accidentally cause this
1186-
// function to get deleted.
1187-
//
11881183
// * `--export=*tls*` - when `#[thread_local]` symbols are used these
11891184
// symbols are how the TLS segments are initialized and configured.
11901185
if sess.target_features.contains(&sym::atomics) {
11911186
cmd.arg("--shared-memory");
11921187
cmd.arg("--max-memory=1073741824");
11931188
cmd.arg("--import-memory");
1194-
cmd.arg("--export=__wasm_init_memory");
11951189
cmd.arg("--export=__wasm_init_tls");
11961190
cmd.arg("--export=__tls_size");
11971191
cmd.arg("--export=__tls_align");

0 commit comments

Comments
 (0)
Failed to load comments.