File tree Expand file tree Collapse file tree 3 files changed +24
-4
lines changed Expand file tree Collapse file tree 3 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -235,8 +235,7 @@ impl Step for Std {
235235 . join ( compiler. host )
236236 . join ( "bin" ) ;
237237 if src_sysroot_bin. exists ( ) {
238- let target_sysroot_bin =
239- builder. sysroot_libdir ( compiler, target) . parent ( ) . unwrap ( ) . join ( "bin" ) ;
238+ let target_sysroot_bin = builder. sysroot_bindir ( compiler, target) ;
240239 t ! ( fs:: create_dir_all( & target_sysroot_bin) ) ;
241240 builder. cp_link_r ( & src_sysroot_bin, & target_sysroot_bin) ;
242241 }
@@ -1976,6 +1975,14 @@ impl Step for Assemble {
19761975 }
19771976 }
19781977
1978+ {
1979+ // `llvm-strip` is used by rustc, which is actually just a symlink to `llvm-objcopy`,
1980+ // so copy and rename `llvm-objcopy`.
1981+ let src_exe = exe ( "llvm-objcopy" , target_compiler. host ) ;
1982+ let dst_exe = exe ( "rust-objcopy" , target_compiler. host ) ;
1983+ builder. copy_link ( & libdir_bin. join ( src_exe) , & libdir_bin. join ( dst_exe) ) ;
1984+ }
1985+
19791986 // In addition to `rust-lld` also install `wasm-component-ld` when
19801987 // LLD is enabled. This is a relatively small binary that primarily
19811988 // delegates to the `rust-lld` binary for linking and then runs
Original file line number Diff line number Diff line change @@ -459,7 +459,7 @@ impl Step for Rustc {
459459
460460 // Copy over lld if it's there
461461 if builder. config . lld_enabled {
462- let src_dir = builder. sysroot_libdir ( compiler, host) . parent ( ) . unwrap ( ) . join ( "bin" ) ;
462+ let src_dir = builder. sysroot_bindir ( compiler, host) ;
463463 let rust_lld = exe ( "rust-lld" , compiler. host ) ;
464464 builder. copy_link ( & src_dir. join ( & rust_lld) , & dst_dir. join ( & rust_lld) ) ;
465465 let self_contained_lld_src_dir = src_dir. join ( "gcc-ld" ) ;
@@ -473,8 +473,16 @@ impl Step for Rustc {
473473 ) ;
474474 }
475475 }
476+
477+ {
478+ let src_dir = builder. sysroot_bindir ( compiler, host) ;
479+ let llvm_objcopy = exe ( "llvm-objcopy" , compiler. host ) ;
480+ let rust_objcopy = exe ( "rust-objcopy" , compiler. host ) ;
481+ builder. copy_link ( & src_dir. join ( & llvm_objcopy) , & dst_dir. join ( & rust_objcopy) ) ;
482+ }
483+
476484 if builder. tool_enabled ( "wasm-component-ld" ) {
477- let src_dir = builder. sysroot_libdir ( compiler, host) . parent ( ) . unwrap ( ) . join ( "bin" ) ;
485+ let src_dir = builder. sysroot_bindir ( compiler, host) ;
478486 let ld = exe ( "wasm-component-ld" , compiler. host ) ;
479487 builder. copy_link ( & src_dir. join ( & ld) , & dst_dir. join ( & ld) ) ;
480488 }
Original file line number Diff line number Diff line change @@ -1161,6 +1161,11 @@ impl<'a> Builder<'a> {
11611161 self . ensure ( compile:: Sysroot :: new ( compiler) )
11621162 }
11631163
1164+ /// Returns the bindir for a compiler's sysroot.
1165+ pub fn sysroot_bindir ( & self , compiler : Compiler , target : TargetSelection ) -> PathBuf {
1166+ self . sysroot_libdir ( compiler, target) . parent ( ) . unwrap ( ) . join ( "bin" )
1167+ }
1168+
11641169 /// Returns the libdir where the standard library and other artifacts are
11651170 /// found for a compiler's sysroot.
11661171 pub fn sysroot_libdir ( & self , compiler : Compiler , target : TargetSelection ) -> PathBuf {
You can’t perform that action at this time.
0 commit comments