File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -826,6 +826,20 @@ impl Step for Lld {
826826 let LlvmResult { llvm_config, llvm_cmake_dir } =
827827 builder. ensure ( Llvm { target : self . target } ) ;
828828
829+ // The `dist` step packages LLD next to LLVM's binaries for download-ci-llvm. The root path
830+ // we usually expect here is `./build/$triple/ci-llvm/`, with the binaries in its `bin`
831+ // subfolder. We check if that's the case, and if LLD's binary already exists there next to
832+ // `llvm-config`: if so, we can use it instead of building LLVM/LLD from source.
833+ let ci_llvm_bin = llvm_config. parent ( ) . unwrap ( ) ;
834+ if ci_llvm_bin. is_dir ( ) && ci_llvm_bin. file_name ( ) . unwrap ( ) == "bin" {
835+ let lld_path = ci_llvm_bin. join ( exe ( "lld" , target) ) ;
836+ if lld_path. exists ( ) {
837+ // The following steps copying `lld` as `rust-lld` to the sysroot, expect it in the
838+ // `bin` subfolder of this step's out dir.
839+ return ci_llvm_bin. parent ( ) . unwrap ( ) . to_path_buf ( ) ;
840+ }
841+ }
842+
829843 let out_dir = builder. lld_out ( target) ;
830844 let done_stamp = out_dir. join ( "lld-finished-building" ) ;
831845 if done_stamp. exists ( ) {
You can’t perform that action at this time.
0 commit comments