about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src/back
diff options
context:
space:
mode:
authorDan Gohman <dev@sunfishcode.online>2022-09-27 17:33:59 -0700
committerDan Gohman <dev@sunfishcode.online>2022-09-27 17:42:33 -0700
commit7f06d513fbbb01af78fae3586114abd9077b930e (patch)
treec4647c87b53b84c2eeee1ddcad260e043f655c7d /compiler/rustc_codegen_ssa/src/back
parent470e518c4b43265020c882bcf3c86632f5494910 (diff)
downloadrust-7f06d513fbbb01af78fae3586114abd9077b930e.tar.gz
rust-7f06d513fbbb01af78fae3586114abd9077b930e.zip
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.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/back')
-rw-r--r--compiler/rustc_codegen_ssa/src/back/linker.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/linker.rs b/compiler/rustc_codegen_ssa/src/back/linker.rs
index e0bd7a33f73..061053ef2ac 100644
--- a/compiler/rustc_codegen_ssa/src/back/linker.rs
+++ b/compiler/rustc_codegen_ssa/src/back/linker.rs
@@ -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) {}