about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/bootstrap/bin/rustc.rs3
-rw-r--r--src/bootstrap/bin/rustdoc.rs5
-rw-r--r--src/bootstrap/builder.rs8
-rw-r--r--src/bootstrap/test.rs5
4 files changed, 18 insertions, 3 deletions
diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs
index 4dd71ebade1..3694bdbf670 100644
--- a/src/bootstrap/bin/rustc.rs
+++ b/src/bootstrap/bin/rustc.rs
@@ -112,6 +112,9 @@ fn main() {
         if let Ok(host_linker) = env::var("RUSTC_HOST_LINKER") {
             cmd.arg(format!("-Clinker={}", host_linker));
         }
+        if env::var_os("RUSTC_HOST_FUSE_LD_LLD").is_some() {
+            cmd.arg("-Clink-args=-fuse-ld=lld");
+        }
 
         if let Ok(s) = env::var("RUSTC_HOST_CRT_STATIC") {
             if s == "true" {
diff --git a/src/bootstrap/bin/rustdoc.rs b/src/bootstrap/bin/rustdoc.rs
index ab846adf942..cb58eb89ad8 100644
--- a/src/bootstrap/bin/rustdoc.rs
+++ b/src/bootstrap/bin/rustdoc.rs
@@ -42,11 +42,14 @@ fn main() {
     if env::var_os("RUSTC_FORCE_UNSTABLE").is_some() {
         cmd.arg("-Z").arg("force-unstable-if-unmarked");
     }
-    if let Some(linker) = env::var_os("RUSTC_TARGET_LINKER") {
+    if let Some(linker) = env::var_os("RUSTDOC_LINKER") {
         let mut arg = OsString::from("-Clinker=");
         arg.push(&linker);
         cmd.arg(arg);
     }
+    if env::var_os("RUSTDOC_FUSE_LD_LLD").is_some() {
+        cmd.arg("-Clink-args=-fuse-ld=lld");
+    }
 
     // Needed to be able to run all rustdoc tests.
     if let Some(ref x) = env::var_os("RUSTDOC_RESOURCE_SUFFIX") {
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 33b03d57dd4..ca2e159d2d9 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -756,7 +756,10 @@ impl<'a> Builder<'a> {
         cmd.env_remove("MFLAGS");
 
         if let Some(linker) = self.linker(compiler.host) {
-            cmd.env("RUSTC_TARGET_LINKER", linker);
+            cmd.env("RUSTDOC_LINKER", linker);
+        }
+        if self.config.use_lld && !compiler.host.contains("msvc") {
+            cmd.env("RUSTDOC_FUSE_LD_LLD", "1");
         }
         cmd
     }
@@ -1044,6 +1047,9 @@ impl<'a> Builder<'a> {
         if let Some(host_linker) = self.linker(compiler.host) {
             cargo.env("RUSTC_HOST_LINKER", host_linker);
         }
+        if self.config.use_lld && !compiler.host.contains("msvc") {
+            cargo.env("RUSTC_HOST_FUSE_LD_LLD", "1");
+        }
 
         if let Some(target_linker) = self.linker(target) {
             let target = crate::envify(&target.triple);
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index f56c994523c..98a219e3979 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -601,7 +601,10 @@ impl Step for RustdocTheme {
             .env("RUSTDOC_REAL", builder.rustdoc(self.compiler))
             .env("RUSTC_BOOTSTRAP", "1");
         if let Some(linker) = builder.linker(self.compiler.host) {
-            cmd.env("RUSTC_TARGET_LINKER", linker);
+            cmd.env("RUSTDOC_LINKER", linker);
+        }
+        if builder.config.use_lld && !self.compiler.host.contains("msvc") {
+            cmd.env("RUSTDOC_FUSE_LD_LLD", "1");
         }
         try_run(builder, &mut cmd);
     }