about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJimmy Brush <code@jimmah.com>2018-02-12 13:32:55 -0500
committerJimmy Brush <code@jimmah.com>2018-02-13 22:10:27 -0500
commitc8def9222be5079585e15b2902039d371b7527ce (patch)
tree160e3f39476a78715829735a6692c9a91c027a61
parentf0e9af1c5509ecd57c2398085b639abfb15f4ba1 (diff)
downloadrust-c8def9222be5079585e15b2902039d371b7527ce.tar.gz
rust-c8def9222be5079585e15b2902039d371b7527ce.zip
handle -no-pie error from clang
-rw-r--r--src/librustc_trans/back/link.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs
index 6f8b425ad56..0a3e6265c1b 100644
--- a/src/librustc_trans/back/link.rs
+++ b/src/librustc_trans/back/link.rs
@@ -664,11 +664,13 @@ fn link_natively(sess: &Session,
         let out = String::from_utf8_lossy(&out);
 
         // Check to see if the link failed with "unrecognized command line option:
-        // '-no-pie'". If so, reperform the link step without the -no-pie option. This
-        // is safe because if the linker doesn't support -no-pie then it should not
-        // default to linking executables as pie. Different versions of gcc seem to
-        // use different quotes in the error message so don't check for them.
-        if out.contains("unrecognized command line option") &&
+        // '-no-pie'" for gcc or "unknown argument: '-no-pie'" for clang. If so,
+        // reperform the link step without the -no-pie option. This is safe because
+        // if the linker doesn't support -no-pie then it should not default to
+        // linking executables as pie. Different versions of gcc seem to use
+        // different quotes in the error message so don't check for them.
+        if (out.contains("unrecognized command line option") ||
+            out.contains("unknown argument")) &&
            out.contains("-no-pie") &&
            cmd.get_args().iter().any(|e| e.to_string_lossy() == "-no-pie") {
             info!("linker output: {:?}", out);