Skip to content

Commit 7cc4518

Browse files
authored
Rollup merge of #72785 - petrochenkov:wholemsvc, r=matthewjasper
linker: MSVC supports linking static libraries as a whole archive
2 parents 70622db + d1c275b commit 7cc4518

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/librustc_codegen_ssa/back/linker.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -721,12 +721,14 @@ impl<'a> Linker for MsvcLinker<'a> {
721721
}
722722

723723
fn link_whole_staticlib(&mut self, lib: Symbol, _search_path: &[PathBuf]) {
724-
// not supported?
725724
self.link_staticlib(lib);
725+
self.cmd.arg(format!("/WHOLEARCHIVE:{}.lib", lib));
726726
}
727727
fn link_whole_rlib(&mut self, path: &Path) {
728-
// not supported?
729728
self.link_rlib(path);
729+
let mut arg = OsString::from("/WHOLEARCHIVE:");
730+
arg.push(path);
731+
self.cmd.arg(arg);
730732
}
731733
fn optimize(&mut self) {
732734
// Needs more investigation of `/OPT` arguments

0 commit comments

Comments
 (0)