From 53ac852bf0cef1db971d27dd9c733c639b85430d Mon Sep 17 00:00:00 2001 From: Markus Siemens Date: Wed, 22 Oct 2014 22:23:22 +0200 Subject: [PATCH] Fail immediately if linking returns status code != 0 --- src/librustc/back/write.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/librustc/back/write.rs b/src/librustc/back/write.rs index f1cd8b52e5ed3..474e8e45d94c2 100644 --- a/src/librustc/back/write.rs +++ b/src/librustc/back/write.rs @@ -714,7 +714,13 @@ pub fn run_passes(sess: &Session, .stdout(::std::io::process::InheritFd(1)) .stderr(::std::io::process::InheritFd(2)); match cmd.status() { - Ok(_) => {}, + Ok(status) => { + if !status.success() { + sess.err(format!("linking of {} with `{}` failed", + output_path.display(), cmd).as_slice()); + sess.abort_if_errors(); + } + }, Err(e) => { sess.err(format!("could not exec the linker `{}`: {}", pname,