Rollup merge of #72785 - petrochenkov:wholemsvc, r=matthewjasper
linker: MSVC supports linking static libraries as a whole archive
This commit is contained in:
commit
7cc45183ca
1 changed files with 4 additions and 2 deletions
|
@ -721,12 +721,14 @@ impl<'a> Linker for MsvcLinker<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn link_whole_staticlib(&mut self, lib: Symbol, _search_path: &[PathBuf]) {
|
fn link_whole_staticlib(&mut self, lib: Symbol, _search_path: &[PathBuf]) {
|
||||||
// not supported?
|
|
||||||
self.link_staticlib(lib);
|
self.link_staticlib(lib);
|
||||||
|
self.cmd.arg(format!("/WHOLEARCHIVE:{}.lib", lib));
|
||||||
}
|
}
|
||||||
fn link_whole_rlib(&mut self, path: &Path) {
|
fn link_whole_rlib(&mut self, path: &Path) {
|
||||||
// not supported?
|
|
||||||
self.link_rlib(path);
|
self.link_rlib(path);
|
||||||
|
let mut arg = OsString::from("/WHOLEARCHIVE:");
|
||||||
|
arg.push(path);
|
||||||
|
self.cmd.arg(arg);
|
||||||
}
|
}
|
||||||
fn optimize(&mut self) {
|
fn optimize(&mut self) {
|
||||||
// Needs more investigation of `/OPT` arguments
|
// Needs more investigation of `/OPT` arguments
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue