Skip to content

Commit 6f67cc5

Browse files
committed
Don't enable shared memory with Wasm atomics
1 parent 1e1a394 commit 6f67cc5

File tree

1 file changed

+1
-31
lines changed

1 file changed

+1
-31
lines changed

compiler/rustc_codegen_ssa/src/back/linker.rs

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,37 +1324,7 @@ struct WasmLd<'a> {
13241324

13251325
impl<'a> WasmLd<'a> {
13261326
fn new(cmd: Command, sess: &'a Session) -> WasmLd<'a> {
1327-
// If the atomics feature is enabled for wasm then we need a whole bunch
1328-
// of flags:
1329-
//
1330-
// * `--shared-memory` - the link won't even succeed without this, flags
1331-
// the one linear memory as `shared`
1332-
//
1333-
// * `--max-memory=1G` - when specifying a shared memory this must also
1334-
// be specified. We conservatively choose 1GB but users should be able
1335-
// to override this with `-C link-arg`.
1336-
//
1337-
// * `--import-memory` - it doesn't make much sense for memory to be
1338-
// exported in a threaded module because typically you're
1339-
// sharing memory and instantiating the module multiple times. As a
1340-
// result if it were exported then we'd just have no sharing.
1341-
//
1342-
// On wasm32-unknown-unknown, we also export symbols for glue code to use:
1343-
// * `--export=*tls*` - when `#[thread_local]` symbols are used these
1344-
// symbols are how the TLS segments are initialized and configured.
1345-
let mut wasm_ld = WasmLd { cmd, sess };
1346-
if sess.target_features.contains(&sym::atomics) {
1347-
wasm_ld.link_args(&["--shared-memory", "--max-memory=1073741824", "--import-memory"]);
1348-
if sess.target.os == "unknown" || sess.target.os == "none" {
1349-
wasm_ld.link_args(&[
1350-
"--export=__wasm_init_tls",
1351-
"--export=__tls_size",
1352-
"--export=__tls_align",
1353-
"--export=__tls_base",
1354-
]);
1355-
}
1356-
}
1357-
wasm_ld
1327+
WasmLd { cmd, sess }
13581328
}
13591329
}
13601330

0 commit comments

Comments
 (0)