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 9c4b247

Browse files
authoredSep 28, 2022
Rollup merge of rust-lang#102385 - sunfishcode:sunfishcode/wasm-no-export-heap-base, r=davidtwco
Don't export `__heap_base` and `__data_end` on wasm32-wasi. `__heap_base` and `__data_end` are exported for use by wasm-bindgen, which uses the wasm32-unknown-unknown target. On wasm32-wasi, as a step toward implementing the Canonical ABI, and as an aid to building speicalized WASI API polyfill wrappers, don't export `__heap_base` and `__data_end` on wasm32-wasi.
2 parents d049c3e + 7f06d51 commit 9c4b247

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed
 

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

+6-4
Original file line numberDiff line numberDiff line change
@@ -1320,10 +1320,12 @@ impl<'a> Linker for WasmLd<'a> {
13201320

13211321
// LLD will hide these otherwise-internal symbols since it only exports
13221322
// symbols explicitly passed via the `--export` flags above and hides all
1323-
// others. Various bits and pieces of tooling use this, so be sure these
1324-
// symbols make their way out of the linker as well.
1325-
self.cmd.arg("--export=__heap_base");
1326-
self.cmd.arg("--export=__data_end");
1323+
// others. Various bits and pieces of wasm32-unknown-unknown tooling use
1324+
// this, so be sure these symbols make their way out of the linker as well.
1325+
if self.sess.target.os == "unknown" {
1326+
self.cmd.arg("--export=__heap_base");
1327+
self.cmd.arg("--export=__data_end");
1328+
}
13271329
}
13281330

13291331
fn subsystem(&mut self, _subsystem: &str) {}

0 commit comments

Comments
 (0)
Failed to load comments.