Skip to content

Commit

Permalink
linker: MSVC supports linking static libraries as a whole archive
Browse files Browse the repository at this point in the history
  • Loading branch information
petrochenkov committed May 30, 2020
1 parent 91fb72a commit d1c275b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/librustc_codegen_ssa/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -704,12 +704,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
Expand Down

0 comments on commit d1c275b

Please sign in to comment.