about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2020-06-19 14:29:18 +0200
committerGitHub <noreply@github.com>2020-06-19 14:29:18 +0200
commit7cc45183cac5a4cfea21ecf94aa397781b969ea4 (patch)
treeb5d564f67f1bfcdc78ef992b210bc714bffb6709
parent70622db43d5e0a58f8fe66ff15115e4fcbb5c274 (diff)
parentd1c275b350f9ae74be92114f4819d6afb55d6007 (diff)
downloadrust-7cc45183cac5a4cfea21ecf94aa397781b969ea4.tar.gz
rust-7cc45183cac5a4cfea21ecf94aa397781b969ea4.zip
Rollup merge of #72785 - petrochenkov:wholemsvc, r=matthewjasper
linker: MSVC supports linking static libraries as a whole archive
-rw-r--r--src/librustc_codegen_ssa/back/linker.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/librustc_codegen_ssa/back/linker.rs b/src/librustc_codegen_ssa/back/linker.rs
index efcabc57e6f..6011d422ca6 100644
--- a/src/librustc_codegen_ssa/back/linker.rs
+++ b/src/librustc_codegen_ssa/back/linker.rs
@@ -721,12 +721,14 @@ impl<'a> Linker for MsvcLinker<'a> {
     }
 
     fn link_whole_staticlib(&mut self, lib: Symbol, _search_path: &[PathBuf]) {
-        // not supported?
         self.link_staticlib(lib);
+        self.cmd.arg(format!("/WHOLEARCHIVE:{}.lib", lib));
     }
     fn link_whole_rlib(&mut self, path: &Path) {
-        // not supported?
         self.link_rlib(path);
+        let mut arg = OsString::from("/WHOLEARCHIVE:");
+        arg.push(path);
+        self.cmd.arg(arg);
     }
     fn optimize(&mut self) {
         // Needs more investigation of `/OPT` arguments