Skip to content

Commit

Permalink
Rollup merge of rust-lang#102385 - sunfishcode:sunfishcode/wasm-no-ex…
Browse files Browse the repository at this point in the history
…port-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.
  • Loading branch information
notriddle committed Sep 29, 2022
2 parents 18c0434 + 7f06d51 commit 042c26c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions compiler/rustc_codegen_ssa/src/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1320,10 +1320,12 @@ impl<'a> Linker for WasmLd<'a> {

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

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

0 comments on commit 042c26c

Please sign in to comment.