Skip to content

Commit 1afe0cc

Browse files
committed
---
yaml --- r: 130525 b: refs/heads/try c: 4d9a478 h: refs/heads/master i: 130523: b4729ec v: v3
1 parent 9a7dbc8 commit 1afe0cc

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: c964cb229bd342bdeb0b4506c3a6d32b03e575f6
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 67b97ab6d2b7de9b69fd97dc171fcf8feec932ff
5-
refs/heads/try: 1b676fb7603cd2aa4e0506cb5b67d48c9da1123f
5+
refs/heads/try: 4d9a4786163a9a9831bf4e283b4e408be03a169b
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/librustc/back/write.rs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,19 @@ pub fn run_passes(sess: &Session,
607607
};
608608

609609
let link_obj = |output_path: &Path| {
610+
// Some builds of MinGW GCC will pass --force-exe-suffix to ld, which
611+
// will automatically add a .exe extension if the extension is not
612+
// already .exe or .dll. To ensure consistent behavior on Windows, we
613+
// add the .exe suffix explicitly and then rename the output file to
614+
// the desired path. This will give the correct behavior whether or
615+
// not GCC adds --force-exe-suffix.
616+
let windows_output_path =
617+
if sess.targ_cfg.os == abi::OsWindows {
618+
Some(output_path.with_extension("o.exe"))
619+
} else {
620+
None
621+
};
622+
610623
let pname = get_cc_prog(sess);
611624
let mut cmd = Command::new(pname.as_slice());
612625

@@ -617,7 +630,9 @@ pub fn run_passes(sess: &Session,
617630
cmd.arg(crate_output.with_extension(format!("{}.o", index).as_slice()));
618631
}
619632

620-
cmd.arg("-r").arg("-o").arg(output_path);
633+
cmd.arg("-r")
634+
.arg("-o")
635+
.arg(windows_output_path.as_ref().unwrap_or(output_path));
621636

622637
if (sess.opts.debugging_opts & config::PRINT_LINK_ARGS) != 0 {
623638
println!("{}", &cmd);
@@ -635,6 +650,15 @@ pub fn run_passes(sess: &Session,
635650
sess.abort_if_errors();
636651
},
637652
}
653+
654+
match windows_output_path {
655+
Some(ref windows_path) => {
656+
fs::rename(windows_path, output_path).unwrap();
657+
},
658+
None => {
659+
// The file is already named according to `output_path`.
660+
}
661+
}
638662
};
639663

640664
// Flag to indicate whether the user explicitly requested bitcode.

0 commit comments

Comments
 (0)