@@ -145,7 +145,7 @@ impl Step for ToolBuild {
145145 tool = "rust-tidy" ;
146146 }
147147 let tool_path =
148- copy_link_tool_bin ( builder, target_compiler , self . target , self . mode , tool) ;
148+ copy_link_tool_bin ( builder, self . compiler , self . target , self . mode , tool) ;
149149
150150 ToolBuildResult { tool_path, build_compiler : self . compiler , target_compiler }
151151 }
@@ -976,50 +976,30 @@ impl Step for LlvmBitcodeLinker {
976976 instrument( level = "debug" , name = "LlvmBitcodeLinker::run" , skip_all)
977977 ) ]
978978 fn run ( self , builder : & Builder < ' _ > ) -> PathBuf {
979- let bin_name = "llvm-bitcode-linker" ;
980-
981- // If enabled, use ci-rustc and skip building the in-tree compiler.
982- if !builder. download_rustc ( ) {
983- builder. ensure ( compile:: Std :: new ( self . compiler , self . compiler . host ) ) ;
984- builder. ensure ( compile:: Rustc :: new ( self . compiler , self . target ) ) ;
985- }
986-
987- let cargo = prepare_tool_cargo (
988- builder,
989- self . compiler ,
990- Mode :: ToolRustc ,
991- self . target ,
992- Kind :: Build ,
993- "src/tools/llvm-bitcode-linker" ,
994- SourceType :: InTree ,
995- & self . extra_features ,
996- ) ;
997-
998- let _guard = builder. msg_tool (
999- Kind :: Build ,
1000- Mode :: ToolRustc ,
1001- bin_name,
1002- self . compiler . stage ,
1003- & self . compiler . host ,
1004- & self . target ,
1005- ) ;
1006-
1007- cargo. into_cmd ( ) . run ( builder) ;
1008-
1009- let tool_out = builder
1010- . cargo_out ( self . compiler , Mode :: ToolRustc , self . target )
1011- . join ( exe ( bin_name, self . compiler . host ) ) ;
979+ let ToolBuildResult { tool_path, build_compiler : _build_compiler, target_compiler } =
980+ builder. ensure ( ToolBuild {
981+ compiler : self . compiler ,
982+ target : self . target ,
983+ tool : "llvm-bitcode-linker" ,
984+ mode : Mode :: ToolRustc ,
985+ path : "src/tools/llvm-bitcode-linker" ,
986+ source_type : SourceType :: InTree ,
987+ extra_features : self . extra_features ,
988+ allow_features : "" ,
989+ cargo_args : Vec :: new ( ) ,
990+ } ) ;
1012991
1013- if self . compiler . stage > 0 {
992+ if target_compiler . stage > 0 {
1014993 let bindir_self_contained = builder
1015- . sysroot ( self . compiler )
994+ . sysroot ( target_compiler )
1016995 . join ( format ! ( "lib/rustlib/{}/bin/self-contained" , self . target. triple) ) ;
1017996 t ! ( fs:: create_dir_all( & bindir_self_contained) ) ;
1018- let bin_destination = bindir_self_contained. join ( exe ( bin_name, self . compiler . host ) ) ;
1019- builder. copy_link ( & tool_out, & bin_destination) ;
997+ let bin_destination =
998+ bindir_self_contained. join ( exe ( "llvm-bitcode-linker" , target_compiler. host ) ) ;
999+ builder. copy_link ( & tool_path, & bin_destination) ;
10201000 bin_destination
10211001 } else {
1022- tool_out
1002+ tool_path
10231003 }
10241004 }
10251005}
@@ -1171,7 +1151,7 @@ fn run_tool_build_step(
11711151 path : & ' static str ,
11721152 add_bins_to_sysroot : Option < & [ & str ] > ,
11731153) -> PathBuf {
1174- let tool = builder
1154+ let ToolBuildResult { tool_path , build_compiler : _build_compiler , target_compiler } = builder
11751155 . ensure ( ToolBuild {
11761156 compiler,
11771157 target,
@@ -1182,28 +1162,24 @@ fn run_tool_build_step(
11821162 source_type : SourceType :: InTree ,
11831163 allow_features : "" ,
11841164 cargo_args : vec ! [ ] ,
1185- } )
1186- . tool_path ;
1165+ } ) ;
11871166
11881167 // FIXME: This should just be an if-let-chain, but those are unstable.
11891168 if let Some ( add_bins_to_sysroot) =
1190- add_bins_to_sysroot. filter ( |bins| !bins. is_empty ( ) && compiler . stage > 0 )
1169+ add_bins_to_sysroot. filter ( |bins| !bins. is_empty ( ) && target_compiler . stage > 0 )
11911170 {
1192- let bindir = builder. sysroot ( compiler ) . join ( "bin" ) ;
1171+ let bindir = builder. sysroot ( target_compiler ) . join ( "bin" ) ;
11931172 t ! ( fs:: create_dir_all( & bindir) ) ;
11941173
1195- let tools_out = builder. cargo_out ( compiler, Mode :: ToolRustc , target) ;
1196-
11971174 for add_bin in add_bins_to_sysroot {
1198- let bin_source = tools_out. join ( exe ( add_bin, target) ) ;
1199- let bin_destination = bindir. join ( exe ( add_bin, compiler. host ) ) ;
1200- builder. copy_link ( & bin_source, & bin_destination) ;
1175+ let bin_destination = bindir. join ( exe ( add_bin, target_compiler. host ) ) ;
1176+ builder. copy_link ( & tool_path, & bin_destination) ;
12011177 }
12021178
12031179 // Return a path into the bin dir.
1204- bindir. join ( exe ( tool_name, compiler . host ) )
1180+ bindir. join ( exe ( tool_name, target_compiler . host ) )
12051181 } else {
1206- tool
1182+ tool_path
12071183 }
12081184}
12091185
0 commit comments