@@ -31,7 +31,7 @@ use filetime::FileTime;
3131use serde_json;
3232
3333use util:: { exe, libdir, is_dylib, CiEnv } ;
34- use { Compiler , Mode } ;
34+ use { Compiler , Mode , LLVM_TOOLS } ;
3535use native;
3636use tool;
3737
@@ -775,6 +775,23 @@ fn copy_codegen_backends_to_sysroot(builder: &Builder,
775775 }
776776}
777777
778+ fn copy_llvm_tools_to_sysroot ( builder : & Builder ,
779+ target_compiler : Compiler ) {
780+ let target = target_compiler. host ;
781+
782+ let dst = builder. sysroot_libdir ( target_compiler, target)
783+ . parent ( )
784+ . unwrap ( )
785+ . join ( "bin" ) ;
786+ t ! ( fs:: create_dir_all( & dst) ) ;
787+
788+ let src = builder. llvm_out ( target) . join ( "bin" ) ;
789+ for tool in LLVM_TOOLS {
790+ let exe = exe ( tool, & target) ;
791+ builder. copy ( & src. join ( & exe) , & dst. join ( & exe) ) ;
792+ }
793+ }
794+
778795fn copy_lld_to_sysroot ( builder : & Builder ,
779796 target_compiler : Compiler ,
780797 lld_install_root : & Path ) {
@@ -966,6 +983,9 @@ impl Step for Assemble {
966983 copy_codegen_backends_to_sysroot ( builder,
967984 build_compiler,
968985 target_compiler) ;
986+ if builder. config . ship_llvm_tools {
987+ copy_llvm_tools_to_sysroot ( builder, target_compiler) ;
988+ }
969989 if let Some ( lld_install) = lld_install {
970990 copy_lld_to_sysroot ( builder, target_compiler, & lld_install) ;
971991 }
0 commit comments