Skip to content

Commit d1c275b

Browse files
committed
linker: MSVC supports linking static libraries as a whole archive
1 parent 91fb72a commit d1c275b

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
@@ -704,12 +704,14 @@ impl<'a> Linker for MsvcLinker<'a> {
704704
}
705705

706706
fn link_whole_staticlib(&mut self, lib: Symbol, _search_path: &[PathBuf]) {
707-
// not supported?
708707
self.link_staticlib(lib);
708+
self.cmd.arg(format!("/WHOLEARCHIVE:{}.lib", lib));
709709
}
710710
fn link_whole_rlib(&mut self, path: &Path) {
711-
// not supported?
712711
self.link_rlib(path);
712+
let mut arg = OsString::from("/WHOLEARCHIVE:");
713+
arg.push(path);
714+
self.cmd.arg(arg);
713715
}
714716
fn optimize(&mut self) {
715717
// Needs more investigation of `/OPT` arguments

0 commit comments

Comments
 (0)