linker: MSVC supports linking static libraries as a whole archive · rust-lang/rust@d1c275b (original) (raw)

File tree

1 file changed

lines changed

1 file changed

lines changed

Original file line number Diff line number Diff line change
@@ -704,12 +704,14 @@ impl<'a> Linker for MsvcLinker<'a> {
704 704 }
705 705
706 706 fn link_whole_staticlib(&mut self, lib: Symbol, _search_path: &[PathBuf]) {
707 -// not supported?
708 707 self.link_staticlib(lib);
708 +self.cmd.arg(format!("/WHOLEARCHIVE:{}.lib", lib));
709 709 }
710 710 fn link_whole_rlib(&mut self, path: &Path) {
711 -// not supported?
712 711 self.link_rlib(path);
712 +let mut arg = OsString::from("/WHOLEARCHIVE:");
713 + arg.push(path);
714 +self.cmd.arg(arg);
713 715 }
714 716 fn optimize(&mut self) {
715 717 // Needs more investigation of `/OPT` arguments