@@ -231,7 +231,7 @@ impl Step for Std {
231
231
let target_sysroot_bin =
232
232
builder. sysroot_libdir ( compiler, target) . parent ( ) . unwrap ( ) . join ( "bin" ) ;
233
233
t ! ( fs:: create_dir_all( & target_sysroot_bin) ) ;
234
- builder. cp_r ( & src_sysroot_bin, & target_sysroot_bin) ;
234
+ builder. cp_link_r ( & src_sysroot_bin, & target_sysroot_bin) ;
235
235
}
236
236
}
237
237
@@ -307,7 +307,7 @@ fn copy_and_stamp(
307
307
dependency_type : DependencyType ,
308
308
) {
309
309
let target = libdir. join ( name) ;
310
- builder. copy ( & sourcedir. join ( name) , & target) ;
310
+ builder. copy_link ( & sourcedir. join ( name) , & target) ;
311
311
312
312
target_deps. push ( ( target, dependency_type) ) ;
313
313
}
@@ -316,7 +316,7 @@ fn copy_llvm_libunwind(builder: &Builder<'_>, target: TargetSelection, libdir: &
316
316
let libunwind_path = builder. ensure ( llvm:: Libunwind { target } ) ;
317
317
let libunwind_source = libunwind_path. join ( "libunwind.a" ) ;
318
318
let libunwind_target = libdir. join ( "libunwind.a" ) ;
319
- builder. copy ( & libunwind_source, & libunwind_target) ;
319
+ builder. copy_link ( & libunwind_source, & libunwind_target) ;
320
320
libunwind_target
321
321
}
322
322
@@ -385,7 +385,7 @@ fn copy_self_contained_objects(
385
385
for & obj in & [ "crtbegin.o" , "crtbeginS.o" , "crtend.o" , "crtendS.o" ] {
386
386
let src = crt_path. join ( obj) ;
387
387
let target = libdir_self_contained. join ( obj) ;
388
- builder. copy ( & src, & target) ;
388
+ builder. copy_link ( & src, & target) ;
389
389
target_deps. push ( ( target, DependencyType :: TargetSelfContained ) ) ;
390
390
}
391
391
@@ -418,7 +418,7 @@ fn copy_self_contained_objects(
418
418
for obj in [ "crt2.o" , "dllcrt2.o" ] . iter ( ) {
419
419
let src = compiler_file ( builder, & builder. cc ( target) , target, CLang :: C , obj) ;
420
420
let target = libdir_self_contained. join ( obj) ;
421
- builder. copy ( & src, & target) ;
421
+ builder. copy_link ( & src, & target) ;
422
422
target_deps. push ( ( target, DependencyType :: TargetSelfContained ) ) ;
423
423
}
424
424
}
@@ -637,7 +637,7 @@ impl Step for StdLink {
637
637
let stage0_bin_dir = builder. out . join ( host) . join ( "stage0/bin" ) ;
638
638
let sysroot_bin_dir = sysroot. join ( "bin" ) ;
639
639
t ! ( fs:: create_dir_all( & sysroot_bin_dir) ) ;
640
- builder. cp_r ( & stage0_bin_dir, & sysroot_bin_dir) ;
640
+ builder. cp_link_r ( & stage0_bin_dir, & sysroot_bin_dir) ;
641
641
642
642
// Copy all *.so files from stage0/lib to stage0-sysroot/lib
643
643
let stage0_lib_dir = builder. out . join ( host) . join ( "stage0/lib" ) ;
@@ -646,7 +646,8 @@ impl Step for StdLink {
646
646
let file = t ! ( file) ;
647
647
let path = file. path ( ) ;
648
648
if path. is_file ( ) && is_dylib ( & file. file_name ( ) . into_string ( ) . unwrap ( ) ) {
649
- builder. copy ( & path, & sysroot. join ( "lib" ) . join ( path. file_name ( ) . unwrap ( ) ) ) ;
649
+ builder
650
+ . copy_link ( & path, & sysroot. join ( "lib" ) . join ( path. file_name ( ) . unwrap ( ) ) ) ;
650
651
}
651
652
}
652
653
}
@@ -661,7 +662,7 @@ impl Step for StdLink {
661
662
. join ( host)
662
663
. join ( "codegen-backends" ) ;
663
664
if stage0_codegen_backends. exists ( ) {
664
- builder. cp_r ( & stage0_codegen_backends, & sysroot_codegen_backends) ;
665
+ builder. cp_link_r ( & stage0_codegen_backends, & sysroot_codegen_backends) ;
665
666
}
666
667
}
667
668
}
@@ -684,7 +685,7 @@ fn copy_sanitizers(
684
685
685
686
for runtime in & runtimes {
686
687
let dst = libdir. join ( & runtime. name ) ;
687
- builder. copy ( & runtime. path , & dst) ;
688
+ builder. copy_link ( & runtime. path , & dst) ;
688
689
689
690
// The `aarch64-apple-ios-macabi` and `x86_64-apple-ios-macabi` are also supported for
690
691
// sanitizers, but they share a sanitizer runtime with `${arch}-apple-darwin`, so we do
@@ -790,7 +791,7 @@ impl Step for StartupObjects {
790
791
}
791
792
792
793
let target = sysroot_dir. join ( ( * file) . to_string ( ) + ".o" ) ;
793
- builder. copy ( dst_file, & target) ;
794
+ builder. copy_link ( dst_file, & target) ;
794
795
target_deps. push ( ( target, DependencyType :: Target ) ) ;
795
796
}
796
797
@@ -812,7 +813,7 @@ fn cp_rustc_component_to_ci_sysroot(
812
813
if src. is_dir ( ) {
813
814
t ! ( fs:: create_dir_all( dst) ) ;
814
815
} else {
815
- builder. copy ( & src, & dst) ;
816
+ builder. copy_link ( & src, & dst) ;
816
817
}
817
818
}
818
819
}
@@ -1443,7 +1444,7 @@ fn copy_codegen_backends_to_sysroot(
1443
1444
let dot = filename. find ( '.' ) . unwrap ( ) ;
1444
1445
format ! ( "{}-{}{}" , & filename[ ..dash] , builder. rust_release( ) , & filename[ dot..] )
1445
1446
} ;
1446
- builder. copy ( file, & dst. join ( target_filename) ) ;
1447
+ builder. copy_link ( file, & dst. join ( target_filename) ) ;
1447
1448
}
1448
1449
}
1449
1450
@@ -1599,7 +1600,7 @@ impl Step for Sysroot {
1599
1600
OsStr :: new ( std:: env:: consts:: DLL_EXTENSION ) ,
1600
1601
] ;
1601
1602
let ci_rustc_dir = builder. config . ci_rustc_dir ( ) ;
1602
- builder. cp_filtered ( & ci_rustc_dir, & sysroot, & |path| {
1603
+ builder. cp_link_filtered ( & ci_rustc_dir, & sysroot, & |path| {
1603
1604
if path. extension ( ) . map_or ( true , |ext| !filtered_extensions. contains ( & ext) ) {
1604
1605
return true ;
1605
1606
}
@@ -1791,7 +1792,7 @@ impl Step for Assemble {
1791
1792
let filename = f. file_name ( ) . into_string ( ) . unwrap ( ) ;
1792
1793
if ( is_dylib ( & filename) || is_debug_info ( & filename) ) && !proc_macros. contains ( & filename)
1793
1794
{
1794
- builder. copy ( & f. path ( ) , & rustc_libdir. join ( & filename) ) ;
1795
+ builder. copy_link ( & f. path ( ) , & rustc_libdir. join ( & filename) ) ;
1795
1796
}
1796
1797
}
1797
1798
@@ -1805,15 +1806,15 @@ impl Step for Assemble {
1805
1806
if let Some ( lld_install) = lld_install {
1806
1807
let src_exe = exe ( "lld" , target_compiler. host ) ;
1807
1808
let dst_exe = exe ( "rust-lld" , target_compiler. host ) ;
1808
- builder. copy ( & lld_install. join ( "bin" ) . join ( src_exe) , & libdir_bin. join ( dst_exe) ) ;
1809
+ builder. copy_link ( & lld_install. join ( "bin" ) . join ( src_exe) , & libdir_bin. join ( dst_exe) ) ;
1809
1810
let self_contained_lld_dir = libdir_bin. join ( "gcc-ld" ) ;
1810
1811
t ! ( fs:: create_dir_all( & self_contained_lld_dir) ) ;
1811
1812
let lld_wrapper_exe = builder. ensure ( crate :: core:: build_steps:: tool:: LldWrapper {
1812
1813
compiler : build_compiler,
1813
1814
target : target_compiler. host ,
1814
1815
} ) ;
1815
1816
for name in crate :: LLD_FILE_NAMES {
1816
- builder. copy (
1817
+ builder. copy_link (
1817
1818
& lld_wrapper_exe,
1818
1819
& self_contained_lld_dir. join ( exe ( name, target_compiler. host ) ) ,
1819
1820
) ;
@@ -1838,7 +1839,7 @@ impl Step for Assemble {
1838
1839
// When using `download-ci-llvm`, some of the tools
1839
1840
// may not exist, so skip trying to copy them.
1840
1841
if src_path. exists ( ) {
1841
- builder. copy ( & src_path, & libdir_bin. join ( & tool_exe) ) ;
1842
+ builder. copy_link ( & src_path, & libdir_bin. join ( & tool_exe) ) ;
1842
1843
}
1843
1844
}
1844
1845
}
@@ -1851,7 +1852,7 @@ impl Step for Assemble {
1851
1852
extra_features : vec ! [ ] ,
1852
1853
} ) ;
1853
1854
let tool_exe = exe ( "llvm-bitcode-linker" , target_compiler. host ) ;
1854
- builder. copy ( & src_path, & libdir_bin. join ( & tool_exe) ) ;
1855
+ builder. copy_link ( & src_path, & libdir_bin. join ( & tool_exe) ) ;
1855
1856
}
1856
1857
1857
1858
// Ensure that `libLLVM.so` ends up in the newly build compiler directory,
@@ -1865,7 +1866,7 @@ impl Step for Assemble {
1865
1866
let bindir = sysroot. join ( "bin" ) ;
1866
1867
t ! ( fs:: create_dir_all( bindir) ) ;
1867
1868
let compiler = builder. rustc ( target_compiler) ;
1868
- builder. copy ( & rustc, & compiler) ;
1869
+ builder. copy_link ( & rustc, & compiler) ;
1869
1870
1870
1871
target_compiler
1871
1872
}
@@ -1891,7 +1892,7 @@ pub fn add_to_sysroot(
1891
1892
DependencyType :: Target => sysroot_dst,
1892
1893
DependencyType :: TargetSelfContained => self_contained_dst,
1893
1894
} ;
1894
- builder. copy ( & path, & dst. join ( path. file_name ( ) . unwrap ( ) ) ) ;
1895
+ builder. copy_link ( & path, & dst. join ( path. file_name ( ) . unwrap ( ) ) ) ;
1895
1896
}
1896
1897
}
1897
1898
0 commit comments