Skip to content

Commit 9680ff6

Browse files
committed
Mirror clang's link stage on Windows.
Fixes problem discussed in #811. [Also deduplicate clang --target argument on Windows, because it's passed later on in the "// Target flags" section.]
1 parent 9b569ae commit 9680ff6

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/lib.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,6 +1171,11 @@ impl Build {
11711171
atlmfc_lib.display()
11721172
));
11731173
}
1174+
1175+
if compiler.family == ToolFamily::Clang {
1176+
// Mirror what clang does at link stage
1177+
self.print(&format_args!("cargo:rustc-link-arg=-defaultlib:oldnames"));
1178+
}
11741179
}
11751180

11761181
if self.link_lib_modifiers.is_empty() {
@@ -1712,13 +1717,6 @@ impl Build {
17121717
cmd.push_opt_unless_duplicate(format!("-O{}", opt_level).into());
17131718
}
17141719

1715-
if cmd.family == ToolFamily::Clang && target.contains("windows") {
1716-
// Disambiguate mingw and msvc on Windows. Problem is that
1717-
// depending on the origin clang can default to a mismatchig
1718-
// run-time.
1719-
cmd.push_cc_arg(format!("--target={}", target).into());
1720-
}
1721-
17221720
if cmd.family == ToolFamily::Clang && target.contains("android") {
17231721
// For compatibility with code that doesn't use pre-defined `__ANDROID__` macro.
17241722
// If compiler used via ndk-build or cmake (officially supported build methods)

0 commit comments

Comments
 (0)