@@ -29,7 +29,7 @@ use crate::utils::helpers::{
29
29
self , exe, get_clang_cl_resource_dir, get_closest_merge_base_commit, is_debug_info, is_dylib,
30
30
symlink_dir, t, up_to_date,
31
31
} ;
32
- use crate :: { CLang , Compiler , DependencyType , GitRepo , Mode , LLVM_TOOLS } ;
32
+ use crate :: { CLang , Compiler , DependencyType , GitRepo , Mode } ;
33
33
34
34
#[ derive( Debug , Clone , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
35
35
pub struct Std {
@@ -1890,52 +1890,20 @@ impl Step for Assemble {
1890
1890
// delegates to the `rust-lld` binary for linking and then runs
1891
1891
// logic to create the final binary. This is used by the
1892
1892
// `wasm32-wasip2` target of Rust.
1893
- if builder. build_wasm_component_ld ( ) {
1894
- let wasm_component_ld_exe =
1895
- builder. ensure ( crate :: core:: build_steps:: tool:: WasmComponentLd {
1896
- compiler : build_compiler,
1897
- target : target_compiler. host ,
1898
- } ) ;
1899
- builder. copy_link (
1900
- & wasm_component_ld_exe,
1901
- & libdir_bin. join ( wasm_component_ld_exe. file_name ( ) . unwrap ( ) ) ,
1902
- ) ;
1903
- }
1904
-
1905
- if builder. config . llvm_enabled ( target_compiler. host ) {
1906
- let llvm:: LlvmResult { llvm_config, .. } =
1907
- builder. ensure ( llvm:: Llvm { target : target_compiler. host } ) ;
1908
- if !builder. config . dry_run ( ) && builder. config . llvm_tools_enabled {
1909
- let llvm_bin_dir =
1910
- command ( llvm_config) . arg ( "--bindir" ) . run_capture_stdout ( builder) . stdout ( ) ;
1911
- let llvm_bin_dir = Path :: new ( llvm_bin_dir. trim ( ) ) ;
1912
-
1913
- // Since we've already built the LLVM tools, install them to the sysroot.
1914
- // This is the equivalent of installing the `llvm-tools-preview` component via
1915
- // rustup, and lets developers use a locally built toolchain to
1916
- // build projects that expect llvm tools to be present in the sysroot
1917
- // (e.g. the `bootimage` crate).
1918
- for tool in LLVM_TOOLS {
1919
- let tool_exe = exe ( tool, target_compiler. host ) ;
1920
- let src_path = llvm_bin_dir. join ( & tool_exe) ;
1921
- // When using `download-ci-llvm`, some of the tools
1922
- // may not exist, so skip trying to copy them.
1923
- if src_path. exists ( ) {
1924
- builder. copy_link ( & src_path, & libdir_bin. join ( & tool_exe) ) ;
1925
- }
1926
- }
1927
- }
1928
- }
1893
+ dist:: maybe_install_wasm_component_ld (
1894
+ builder,
1895
+ build_compiler,
1896
+ target_compiler. host ,
1897
+ & libdir_bin,
1898
+ ) ;
1929
1899
1930
- if builder. config . llvm_bitcode_linker_enabled {
1931
- let src_path = builder. ensure ( crate :: core:: build_steps:: tool:: LlvmBitcodeLinker {
1932
- compiler : build_compiler,
1933
- target : target_compiler. host ,
1934
- extra_features : vec ! [ ] ,
1935
- } ) ;
1936
- let tool_exe = exe ( "llvm-bitcode-linker" , target_compiler. host ) ;
1937
- builder. copy_link ( & src_path, & libdir_bin. join ( tool_exe) ) ;
1938
- }
1900
+ dist:: maybe_install_llvm_tools ( builder, target_compiler. host , & libdir_bin) ;
1901
+ dist:: maybe_install_llvm_bitcode_linker (
1902
+ builder,
1903
+ build_compiler,
1904
+ target_compiler. host ,
1905
+ & libdir_bin,
1906
+ ) ;
1939
1907
1940
1908
// Ensure that `libLLVM.so` ends up in the newly build compiler directory,
1941
1909
// so that it can be found when the newly built `rustc` is run.
0 commit comments