Skip to content

Commit 688ed03

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 a211d91 commit 688ed03

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/lib.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -1172,6 +1172,11 @@ impl Build {
11721172
atlmfc_lib.display()
11731173
));
11741174
}
1175+
1176+
if compiler.family == ToolFamily::Clang {
1177+
// Mirror what clang does at link stage
1178+
self.print(&format_args!("cargo:rustc-link-arg=-defaultib:oldnames"));
1179+
}
11751180
}
11761181

11771182
if self.link_lib_modifiers.is_empty() {
@@ -1758,13 +1763,6 @@ impl Build {
17581763
cmd.push_opt_unless_duplicate(format!("-O{}", opt_level).into());
17591764
}
17601765

1761-
if cmd.family == ToolFamily::Clang && target.contains("windows") {
1762-
// Disambiguate mingw and msvc on Windows. Problem is that
1763-
// depending on the origin clang can default to a mismatchig
1764-
// run-time.
1765-
cmd.push_cc_arg(format!("--target={}", target).into());
1766-
}
1767-
17681766
if cmd.family == ToolFamily::Clang && target.contains("android") {
17691767
// For compatibility with code that doesn't use pre-defined `__ANDROID__` macro.
17701768
// If compiler used via ndk-build or cmake (officially supported build methods)

0 commit comments

Comments
 (0)