@@ -33,7 +33,7 @@ use crate::utils::exec::command;
3333use  crate :: utils:: helpers:: { 
3434    exe,  get_clang_cl_resource_dir,  is_debug_info,  is_dylib,  symlink_dir,  t,  up_to_date, 
3535} ; 
36- use  crate :: { CLang ,  Compiler ,  DependencyType ,  GitRepo ,  LLVM_TOOLS ,  Mode ,  debug,  trace} ; 
36+ use  crate :: { CLang ,  Compiler ,  DependencyType ,  FileType ,   GitRepo ,  LLVM_TOOLS ,  Mode ,  debug,  trace} ; 
3737
3838#[ derive( Debug ,  Clone ,  PartialEq ,  Eq ,  PartialOrd ,  Ord ,  Hash ) ]  
3939pub  struct  Std  { 
@@ -321,7 +321,7 @@ fn copy_and_stamp(
321321    dependency_type :  DependencyType , 
322322)  { 
323323    let  target = libdir. join ( name) ; 
324-     builder. copy_link ( & sourcedir. join ( name) ,  & target) ; 
324+     builder. copy_link ( & sourcedir. join ( name) ,  & target,   FileType :: Regular ) ; 
325325
326326    target_deps. push ( ( target,  dependency_type) ) ; 
327327} 
@@ -330,7 +330,7 @@ fn copy_llvm_libunwind(builder: &Builder<'_>, target: TargetSelection, libdir: &
330330    let  libunwind_path = builder. ensure ( llvm:: Libunwind  {  target } ) ; 
331331    let  libunwind_source = libunwind_path. join ( "libunwind.a" ) ; 
332332    let  libunwind_target = libdir. join ( "libunwind.a" ) ; 
333-     builder. copy_link ( & libunwind_source,  & libunwind_target) ; 
333+     builder. copy_link ( & libunwind_source,  & libunwind_target,   FileType :: NativeLibrary ) ; 
334334    libunwind_target
335335} 
336336
@@ -401,7 +401,7 @@ fn copy_self_contained_objects(
401401            for  & obj in  & [ "crtbegin.o" ,  "crtbeginS.o" ,  "crtend.o" ,  "crtendS.o" ]  { 
402402                let  src = crt_path. join ( obj) ; 
403403                let  target = libdir_self_contained. join ( obj) ; 
404-                 builder. copy_link ( & src,  & target) ; 
404+                 builder. copy_link ( & src,  & target,   FileType :: NativeLibrary ) ; 
405405                target_deps. push ( ( target,  DependencyType :: TargetSelfContained ) ) ; 
406406            } 
407407        }  else  { 
@@ -443,9 +443,9 @@ fn copy_self_contained_objects(
443443    }  else  if  target. is_windows_gnu ( )  { 
444444        for  obj in  [ "crt2.o" ,  "dllcrt2.o" ] . iter ( )  { 
445445            let  src = compiler_file ( builder,  & builder. cc ( target) ,  target,  CLang :: C ,  obj) ; 
446-             let  target  = libdir_self_contained. join ( obj) ; 
447-             builder. copy_link ( & src,  & target ) ; 
448-             target_deps. push ( ( target ,  DependencyType :: TargetSelfContained ) ) ; 
446+             let  dst  = libdir_self_contained. join ( obj) ; 
447+             builder. copy_link ( & src,  & dst ,   FileType :: NativeLibrary ) ; 
448+             target_deps. push ( ( dst ,  DependencyType :: TargetSelfContained ) ) ; 
449449        } 
450450    } 
451451
@@ -790,8 +790,11 @@ impl Step for StdLink {
790790                    let  file = t ! ( file) ; 
791791                    let  path = file. path ( ) ; 
792792                    if  path. is_file ( )  { 
793-                         builder
794-                             . copy_link ( & path,  & sysroot. join ( "lib" ) . join ( path. file_name ( ) . unwrap ( ) ) ) ; 
793+                         builder. copy_link ( 
794+                             & path, 
795+                             & sysroot. join ( "lib" ) . join ( path. file_name ( ) . unwrap ( ) ) , 
796+                             FileType :: Regular , 
797+                         ) ; 
795798                    } 
796799                } 
797800            } 
@@ -829,7 +832,7 @@ fn copy_sanitizers(
829832
830833    for  runtime in  & runtimes { 
831834        let  dst = libdir. join ( & runtime. name ) ; 
832-         builder. copy_link ( & runtime. path ,  & dst) ; 
835+         builder. copy_link ( & runtime. path ,  & dst,   FileType :: NativeLibrary ) ; 
833836
834837        // The `aarch64-apple-ios-macabi` and `x86_64-apple-ios-macabi` are also supported for 
835838        // sanitizers, but they share a sanitizer runtime with `${arch}-apple-darwin`, so we do 
@@ -934,9 +937,9 @@ impl Step for StartupObjects {
934937                    . run ( builder) ; 
935938            } 
936939
937-             let  target  = sysroot_dir. join ( ( * file) . to_string ( )  + ".o" ) ; 
938-             builder. copy_link ( dst_file,  & target ) ; 
939-             target_deps. push ( ( target ,  DependencyType :: Target ) ) ; 
940+             let  obj  = sysroot_dir. join ( ( * file) . to_string ( )  + ".o" ) ; 
941+             builder. copy_link ( dst_file,  & obj ,   FileType :: NativeLibrary ) ; 
942+             target_deps. push ( ( obj ,  DependencyType :: Target ) ) ; 
940943        } 
941944
942945        target_deps
@@ -952,7 +955,7 @@ fn cp_rustc_component_to_ci_sysroot(builder: &Builder<'_>, sysroot: &Path, conte
952955        if  src. is_dir ( )  { 
953956            t ! ( fs:: create_dir_all( dst) ) ; 
954957        }  else  { 
955-             builder. copy_link ( & src,  & dst) ; 
958+             builder. copy_link ( & src,  & dst,   FileType :: Regular ) ; 
956959        } 
957960    } 
958961} 
@@ -1707,7 +1710,7 @@ fn copy_codegen_backends_to_sysroot(
17071710            let  dot = filename. find ( '.' ) . unwrap ( ) ; 
17081711            format ! ( "{}-{}{}" ,  & filename[ ..dash] ,  builder. rust_release( ) ,  & filename[ dot..] ) 
17091712        } ; 
1710-         builder. copy_link ( file,  & dst. join ( target_filename) ) ; 
1713+         builder. copy_link ( file,  & dst. join ( target_filename) ,   FileType :: NativeLibrary ) ; 
17111714    } 
17121715} 
17131716
@@ -2011,7 +2014,11 @@ impl Step for Assemble {
20112014                        extra_features :  vec ! [ ] , 
20122015                    } ) ; 
20132016                let  tool_exe = exe ( "llvm-bitcode-linker" ,  target_compiler. host ) ; 
2014-                 builder. copy_link ( & llvm_bitcode_linker. tool_path ,  & libdir_bin. join ( tool_exe) ) ; 
2017+                 builder. copy_link ( 
2018+                     & llvm_bitcode_linker. tool_path , 
2019+                     & libdir_bin. join ( tool_exe) , 
2020+                     FileType :: Executable , 
2021+                 ) ; 
20152022            } 
20162023        } ; 
20172024
@@ -2072,8 +2079,8 @@ impl Step for Assemble {
20722079                builder. sysroot_target_libdir ( target_compiler,  target_compiler. host ) ; 
20732080            let  dst_lib = libdir. join ( & libenzyme) . with_extension ( lib_ext) ; 
20742081            let  target_dst_lib = target_libdir. join ( & libenzyme) . with_extension ( lib_ext) ; 
2075-             builder. copy_link ( & src_lib,  & dst_lib) ; 
2076-             builder. copy_link ( & src_lib,  & target_dst_lib) ; 
2082+             builder. copy_link ( & src_lib,  & dst_lib,   FileType :: NativeLibrary ) ; 
2083+             builder. copy_link ( & src_lib,  & target_dst_lib,   FileType :: NativeLibrary ) ; 
20772084        } 
20782085
20792086        // Build the libraries for this compiler to link to (i.e., the libraries 
@@ -2168,7 +2175,7 @@ impl Step for Assemble {
21682175            } ; 
21692176
21702177            if  is_dylib_or_debug && can_be_rustc_dynamic_dep && !is_proc_macro { 
2171-                 builder. copy_link ( & f. path ( ) ,  & rustc_libdir. join ( & filename) ) ; 
2178+                 builder. copy_link ( & f. path ( ) ,  & rustc_libdir. join ( & filename) ,   FileType :: Regular ) ; 
21722179            } 
21732180        } 
21742181
@@ -2196,7 +2203,11 @@ impl Step for Assemble {
21962203            // See <https://github.com/rust-lang/rust/issues/132719>. 
21972204            let  src_exe = exe ( "llvm-objcopy" ,  target_compiler. host ) ; 
21982205            let  dst_exe = exe ( "rust-objcopy" ,  target_compiler. host ) ; 
2199-             builder. copy_link ( & libdir_bin. join ( src_exe) ,  & libdir_bin. join ( dst_exe) ) ; 
2206+             builder. copy_link ( 
2207+                 & libdir_bin. join ( src_exe) , 
2208+                 & libdir_bin. join ( dst_exe) , 
2209+                 FileType :: Executable , 
2210+             ) ; 
22002211        } 
22012212
22022213        // In addition to `rust-lld` also install `wasm-component-ld` when 
@@ -2212,6 +2223,7 @@ impl Step for Assemble {
22122223            builder. copy_link ( 
22132224                & wasm_component. tool_path , 
22142225                & libdir_bin. join ( wasm_component. tool_path . file_name ( ) . unwrap ( ) ) , 
2226+                 FileType :: Executable , 
22152227            ) ; 
22162228        } 
22172229
@@ -2234,7 +2246,7 @@ impl Step for Assemble {
22342246        t ! ( fs:: create_dir_all( bindir) ) ; 
22352247        let  compiler = builder. rustc ( target_compiler) ; 
22362248        debug ! ( src = ?rustc,  dst = ?compiler,  "linking compiler binary itself" ) ; 
2237-         builder. copy_link ( & rustc,  & compiler) ; 
2249+         builder. copy_link ( & rustc,  & compiler,   FileType :: Executable ) ; 
22382250
22392251        target_compiler
22402252    } 
@@ -2260,7 +2272,7 @@ pub fn add_to_sysroot(
22602272            DependencyType :: Target  => sysroot_dst, 
22612273            DependencyType :: TargetSelfContained  => self_contained_dst, 
22622274        } ; 
2263-         builder. copy_link ( & path,  & dst. join ( path. file_name ( ) . unwrap ( ) ) ) ; 
2275+         builder. copy_link ( & path,  & dst. join ( path. file_name ( ) . unwrap ( ) ) ,   FileType :: Regular ) ; 
22642276    } 
22652277} 
22662278
0 commit comments