@@ -35,16 +35,11 @@ use {Build, Compiler, Mode};
3535/// created will also be linked into the sysroot directory.
3636pub fn std ( build : & Build , target : & str , compiler : & Compiler ) {
3737 let libdir = build. sysroot_libdir ( compiler, target) ;
38- let _ = fs:: remove_dir_all ( & libdir) ;
3938 t ! ( fs:: create_dir_all( & libdir) ) ;
4039
4140 println ! ( "Building stage{} std artifacts ({} -> {})" , compiler. stage,
4241 compiler. host, target) ;
4342
44- // Some platforms have startup objects that may be required to produce the
45- // libstd dynamic library, for example.
46- build_startup_objects ( build, target, & libdir) ;
47-
4843 let out_dir = build. cargo_out ( compiler, Mode :: Libstd , target) ;
4944 build. clear_if_dirty ( & out_dir, & build. compiler_path ( compiler) ) ;
5045 let mut cargo = build. cargo ( compiler, Mode :: Libstd , target, "build" ) ;
@@ -111,20 +106,23 @@ fn copy_musl_third_party_objects(build: &Build, target: &str, into: &Path) {
111106/// They don't require any library support as they're just plain old object
112107/// files, so we just use the nightly snapshot compiler to always build them (as
113108/// no other compilers are guaranteed to be available).
114- fn build_startup_objects ( build : & Build , target : & str , into : & Path ) {
109+ pub fn build_startup_objects ( build : & Build , for_compiler : & Compiler , target : & str ) {
115110 if !target. contains ( "pc-windows-gnu" ) {
116111 return
117112 }
113+
118114 let compiler = Compiler :: new ( 0 , & build. config . build ) ;
119115 let compiler_path = build. compiler_path ( & compiler) ;
116+ let into = build. sysroot_libdir ( for_compiler, target) ;
117+ t ! ( fs:: create_dir_all( & into) ) ;
120118
121119 for file in t ! ( fs:: read_dir( build. src. join( "src/rtstartup" ) ) ) {
122120 let file = t ! ( file) ;
123121 let mut cmd = Command :: new ( & compiler_path) ;
124122 build. run ( cmd. env ( "RUSTC_BOOTSTRAP" , "1" )
125123 . arg ( "--target" ) . arg ( target)
126124 . arg ( "--emit=obj" )
127- . arg ( "--out-dir" ) . arg ( into)
125+ . arg ( "--out-dir" ) . arg ( & into)
128126 . arg ( file. path ( ) ) ) ;
129127 }
130128
@@ -155,6 +153,12 @@ pub fn test_link(build: &Build,
155153 compiler : & Compiler ,
156154 target_compiler : & Compiler ,
157155 target : & str ) {
156+ println ! ( "Copying stage{} test from stage{} ({} -> {} / {})" ,
157+ target_compiler. stage,
158+ compiler. stage,
159+ compiler. host,
160+ target_compiler. host,
161+ target) ;
158162 let libdir = build. sysroot_libdir ( & target_compiler, target) ;
159163 let out_dir = build. cargo_out ( & compiler, Mode :: Libtest , target) ;
160164 add_to_sysroot ( & out_dir, & libdir) ;
@@ -224,6 +228,12 @@ pub fn rustc_link(build: &Build,
224228 compiler : & Compiler ,
225229 target_compiler : & Compiler ,
226230 target : & str ) {
231+ println ! ( "Copying stage{} rustc from stage{} ({} -> {} / {})" ,
232+ target_compiler. stage,
233+ compiler. stage,
234+ compiler. host,
235+ target_compiler. host,
236+ target) ;
227237 let libdir = build. sysroot_libdir ( & target_compiler, target) ;
228238 let out_dir = build. cargo_out ( & compiler, Mode :: Librustc , target) ;
229239 add_to_sysroot ( & out_dir, & libdir) ;
0 commit comments