about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMateusz Mikuła <mati865@gmail.com>2020-08-03 15:39:09 +0200
committerMateusz Mikuła <mati865@gmail.com>2020-08-03 18:10:37 +0200
commit594f81a2b4dae23827271ea3a4bbb21c1a0004e1 (patch)
treee96c46960535a02d989e80176496f21b71b8dd26 /src
parent3a92b9987abd01c4b7e59c870e85beb9dd4d4aa2 (diff)
downloadrust-594f81a2b4dae23827271ea3a4bbb21c1a0004e1.tar.gz
rust-594f81a2b4dae23827271ea3a4bbb21c1a0004e1.zip
Make rust.use-lld config option work with non MSVC targets
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/builder.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 144e146685f..e13a5f24653 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -1037,7 +1037,7 @@ impl<'a> Builder<'a> {
             }
         }
 
-        // FIXME: Don't use LLD if we're compiling libtest, since it fails to link it.
+        // FIXME: Don't use LLD with MSVC if we're compiling libtest, since it fails to link it.
         // See https://github.com/rust-lang/rust/issues/68647.
         let can_use_lld = mode != Mode::Std;
 
@@ -1049,6 +1049,11 @@ impl<'a> Builder<'a> {
             let target = crate::envify(&target.triple);
             cargo.env(&format!("CARGO_TARGET_{}_LINKER", target), target_linker);
         }
+
+        if self.config.use_lld && !target.contains("msvc") {
+            rustflags.arg("-Clink-args=-fuse-ld=lld");
+        }
+
         if !(["build", "check", "clippy", "fix", "rustc"].contains(&cmd)) && want_rustdoc {
             cargo.env("RUSTDOC_LIBDIR", self.rustc_libdir(compiler));
         }