Rollup merge of #72785 - petrochenkov:wholemsvc, r=matthewjasper

linker: MSVC supports linking static libraries as a whole archive
This commit is contained in:
Ralf Jung 2020-06-19 14:29:18 +02:00 committed by GitHub
commit 7cc45183ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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