diff options
| author | bjorn3 <bjorn3@users.noreply.github.com> | 2022-05-06 17:20:42 +0200 |
|---|---|---|
| committer | bjorn3 <bjorn3@users.noreply.github.com> | 2022-06-03 17:02:14 +0000 |
| commit | 5cc3593c17360edd92977301ca66551a45119619 (patch) | |
| tree | b8869e04fb13b870d74f9bbbe4f6cfc6b1431afd /compiler/rustc_codegen_ssa/src | |
| parent | 606848a61ea6d303b2aa3d4cf01881a11971c0c1 (diff) | |
| download | rust-5cc3593c17360edd92977301ca66551a45119619.tar.gz rust-5cc3593c17360edd92977301ca66551a45119619.zip | |
Fix emscripten linker invocation
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/linker.rs | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/linker.rs b/compiler/rustc_codegen_ssa/src/back/linker.rs index dca11a8e00c..a24e4347839 100644 --- a/compiler/rustc_codegen_ssa/src/back/linker.rs +++ b/compiler/rustc_codegen_ssa/src/back/linker.rs @@ -1146,24 +1146,17 @@ impl<'a> Linker for EmLinker<'a> { } fn export_symbols(&mut self, _tmpdir: &Path, _crate_type: CrateType, symbols: &[String]) { - use std::fmt::Write; - debug!("EXPORTED SYMBOLS:"); - let mut encoded = "[".to_string(); - let mut symbols = symbols.iter(); - if let Some(first_symbol) = symbols.next() { - write!(encoded, "{:?}", first_symbol).unwrap(); - } - for symbol in symbols { - write!(encoded, ",{:?}", symbol).unwrap(); - } - encoded.push(']'); - debug!("{}", encoded); - self.cmd.arg("-s"); let mut arg = OsString::from("EXPORTED_FUNCTIONS="); + let encoded = serde_json::to_string( + &symbols.iter().map(|sym| "_".to_owned() + sym).collect::<Vec<_>>(), + ) + .unwrap(); + debug!("{}", encoded); + arg.push(encoded); self.cmd.arg(arg); |
