summary refs log tree commit diff
path: root/src/bootstrap/lib.rs
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2020-09-07 00:39:58 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2020-09-07 00:40:07 +0300
commitb27fca71d46b2da88611bb5cc8cfb6e90c0a4af0 (patch)
treebbcb579f0732293c267d935ae3d2452988965907 /src/bootstrap/lib.rs
parent5118a51b4d49a139ea21d280001105948de298f7 (diff)
downloadrust-b27fca71d46b2da88611bb5cc8cfb6e90c0a4af0.tar.gz
rust-b27fca71d46b2da88611bb5cc8cfb6e90c0a4af0.zip
rustbuild: Deduplicate LLD checks slightly
Diffstat (limited to 'src/bootstrap/lib.rs')
-rw-r--r--src/bootstrap/lib.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index 642f1ea9c00..8d60284cd4f 100644
--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
@@ -863,15 +863,19 @@ impl Build {
             && !target.contains("msvc")
         {
             Some(self.cc(target))
-        } else if target.contains("msvc") && self.config.use_lld && self.build == target {
-            // `rust.use_lld` means using LLD directly only for MSVC, for other targets it only
-            // adds `-fuse-ld=lld` to already selected linker.
+        } else if self.config.use_lld && !self.is_fuse_ld_lld(target) && self.build == target {
             Some(&self.initial_lld)
         } else {
             None
         }
     }
 
+    // LLD is used through `-fuse-ld=lld` rather than directly.
+    // Only MSVC targets use LLD directly at the moment.
+    fn is_fuse_ld_lld(&self, target: TargetSelection) -> bool {
+        self.config.use_lld && !target.contains("msvc")
+    }
+
     /// Returns if this target should statically link the C runtime, if specified
     fn crt_static(&self, target: TargetSelection) -> Option<bool> {
         if target.contains("pc-windows-msvc") {