Skip to content

Commit 6e4c842

Browse files
authored
Rollup merge of rust-lang#84866 - petrochenkov:wholesome, r=Mark-Simulacrum
linker: Avoid library duplication with `/WHOLEARCHIVE` Looks like in rust-lang#72785 I misinterpreted how the `link.exe`'s `/WHOLEARCHIVE` flag works. It's not necessary to write `mylib /WHOLEARCHIVE:mylib` to mark `mylib` as whole archive, `/WHOLEARCHIVE:mylib` alone is enough. https://docs.microsoft.com/en-us/cpp/build/reference/wholearchive-include-all-library-object-files?view=msvc-160
2 parents 8f0b186 + fb9feb3 commit 6e4c842

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

compiler/rustc_codegen_ssa/src/back/linker.rs

-2
Original file line numberDiff line numberDiff line change
@@ -821,11 +821,9 @@ impl<'a> Linker for MsvcLinker<'a> {
821821
}
822822

823823
fn link_whole_staticlib(&mut self, lib: Symbol, verbatim: bool, _search_path: &[PathBuf]) {
824-
self.link_staticlib(lib, verbatim);
825824
self.cmd.arg(format!("/WHOLEARCHIVE:{}{}", lib, if verbatim { "" } else { ".lib" }));
826825
}
827826
fn link_whole_rlib(&mut self, path: &Path) {
828-
self.link_rlib(path);
829827
let mut arg = OsString::from("/WHOLEARCHIVE:");
830828
arg.push(path);
831829
self.cmd.arg(arg);

0 commit comments

Comments
 (0)