]> git.lizzy.rs Git - rust.git/blobdiff - src/bootstrap/lib.rs
Auto merge of #86015 - jyn514:revert-revert, r=Mark-Simulacrum
[rust.git] / src / bootstrap / lib.rs
index 21c7dd11d248bbbaf41ff58702234e532bb60674..8e8c27b0d0dc9952311449d85d179ac6685768ed 100644 (file)
@@ -483,6 +483,12 @@ pub fn build(&mut self) {
             job::setup(self);
         }
 
+        // If the LLVM submodule has been initialized already, sync it unconditionally. This avoids
+        // contributors checking in a submodule change by accident.
+        if self.in_tree_llvm_info.is_git() {
+            native::update_llvm_submodule(self);
+        }
+
         if let Subcommand::Format { check, paths } = &self.config.cmd {
             return format::format(self, *check, &paths);
         }
@@ -923,6 +929,21 @@ fn is_fuse_ld_lld(&self, target: TargetSelection) -> bool {
         self.config.use_lld && !target.contains("msvc")
     }
 
+    fn lld_flags(&self, target: TargetSelection) -> impl Iterator<Item = String> {
+        let mut options = [None, None];
+
+        if self.config.use_lld {
+            if self.is_fuse_ld_lld(target) {
+                options[0] = Some("-Clink-arg=-fuse-ld=lld".to_string());
+            }
+
+            let threads = if target.contains("windows") { "/threads:1" } else { "--threads=1" };
+            options[1] = Some(format!("-Clink-arg=-Wl,{}", threads));
+        }
+
+        std::array::IntoIter::new(options).flatten()
+    }
+
     /// 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") {