diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2022-09-23 17:06:28 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2022-09-23 17:06:28 -0700 |
| commit | 6630c146f213088dff0d4ebd8dad90591544c169 (patch) | |
| tree | 094589690f3134dbdf4d5b21de3257aa1cdb1973 /compiler/rustc_codegen_ssa/src/back | |
| parent | 8ab71ab59fd17a1c51d23b68eced935b92431b70 (diff) | |
| download | rust-6630c146f213088dff0d4ebd8dad90591544c169.tar.gz rust-6630c146f213088dff0d4ebd8dad90591544c169.zip | |
Implement the `+whole-archive` modifier for `wasm-ld`
This implements the `Linker::{link_whole_staticlib,link_whole_rlib}`
methods for the `WasmLd` linker used on wasm targets. Previously these
methods were noops since I think historically `wasm-ld` did not have
support for `--whole-archive` but nowadays it does, so the flags are
passed through.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/back')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/linker.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/linker.rs b/compiler/rustc_codegen_ssa/src/back/linker.rs index e0bd7a33f73..6e59a4f64db 100644 --- a/compiler/rustc_codegen_ssa/src/back/linker.rs +++ b/compiler/rustc_codegen_ssa/src/back/linker.rs @@ -1265,11 +1265,11 @@ impl<'a> Linker for WasmLd<'a> { } fn link_whole_staticlib(&mut self, lib: &str, _verbatim: bool, _search_path: &[PathBuf]) { - self.cmd.arg("-l").arg(lib); + self.cmd.arg("--whole-archive").arg("-l").arg(lib).arg("--no-whole-archive"); } fn link_whole_rlib(&mut self, lib: &Path) { - self.cmd.arg(lib); + self.cmd.arg("--whole-archive").arg(lib).arg("--no-whole-archive"); } fn gc_sections(&mut self, _keep_metadata: bool) { |
