Skip to content

Commit 32bf725

Browse files
committed
Make linker search logic think we build a normal -pc- target when searching for link.exe
1 parent acec659 commit 32bf725

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,12 +1021,10 @@ fn link_natively(
10211021
&& (code < 1000 || code > 9999)
10221022
{
10231023
let is_vs_installed = windows_registry::find_vs_version().is_ok();
1024+
let tuple =
1025+
sess.opts.target_triple.tuple().to_owned().replace("rust9x", "pc");
10241026
// FIXME(cc-rs#1265) pass only target arch to find_tool()
1025-
let has_linker = windows_registry::find_tool(
1026-
sess.opts.target_triple.tuple(),
1027-
"link.exe",
1028-
)
1029-
.is_some();
1027+
let has_linker = windows_registry::find_tool(&tuple, "link.exe").is_some();
10301028

10311029
sess.dcx().emit_note(errors::LinkExeUnexpectedError);
10321030
if is_vs_installed && has_linker {

compiler/rustc_codegen_ssa/src/back/linker.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ pub(crate) fn get_linker<'a>(
4747
self_contained: bool,
4848
target_cpu: &'a str,
4949
) -> Box<dyn Linker + 'a> {
50+
let tuple = sess.opts.target_triple.tuple().to_owned().replace("rust9x", "pc");
5051
// FIXME(cc-rs#1265) pass only target arch to find_tool()
51-
let msvc_tool = windows_registry::find_tool(sess.opts.target_triple.tuple(), "link.exe");
52+
let msvc_tool = windows_registry::find_tool(&tuple, "link.exe");
5253

5354
// If our linker looks like a batch script on Windows then to execute this
5455
// we'll need to spawn `cmd` explicitly. This is primarily done to handle

0 commit comments

Comments
 (0)