@@ -35,16 +35,11 @@ use {Build, Compiler, Mode};
35
35
/// created will also be linked into the sysroot directory.
36
36
pub fn std ( build : & Build , target : & str , compiler : & Compiler ) {
37
37
let libdir = build. sysroot_libdir ( compiler, target) ;
38
- let _ = fs:: remove_dir_all ( & libdir) ;
39
38
t ! ( fs:: create_dir_all( & libdir) ) ;
40
39
41
40
println ! ( "Building stage{} std artifacts ({} -> {})" , compiler. stage,
42
41
compiler. host, target) ;
43
42
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
-
48
43
let out_dir = build. cargo_out ( compiler, Mode :: Libstd , target) ;
49
44
build. clear_if_dirty ( & out_dir, & build. compiler_path ( compiler) ) ;
50
45
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) {
111
106
/// They don't require any library support as they're just plain old object
112
107
/// files, so we just use the nightly snapshot compiler to always build them (as
113
108
/// 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 ) {
115
110
if !target. contains ( "pc-windows-gnu" ) {
116
111
return
117
112
}
113
+
118
114
let compiler = Compiler :: new ( 0 , & build. config . build ) ;
119
115
let compiler_path = build. compiler_path ( & compiler) ;
116
+ let into = build. sysroot_libdir ( for_compiler, target) ;
117
+ t ! ( fs:: create_dir_all( & into) ) ;
120
118
121
119
for file in t ! ( fs:: read_dir( build. src. join( "src/rtstartup" ) ) ) {
122
120
let file = t ! ( file) ;
123
121
let mut cmd = Command :: new ( & compiler_path) ;
124
122
build. run ( cmd. env ( "RUSTC_BOOTSTRAP" , "1" )
125
123
. arg ( "--target" ) . arg ( target)
126
124
. arg ( "--emit=obj" )
127
- . arg ( "--out-dir" ) . arg ( into)
125
+ . arg ( "--out-dir" ) . arg ( & into)
128
126
. arg ( file. path ( ) ) ) ;
129
127
}
130
128
@@ -155,6 +153,12 @@ pub fn test_link(build: &Build,
155
153
compiler : & Compiler ,
156
154
target_compiler : & Compiler ,
157
155
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) ;
158
162
let libdir = build. sysroot_libdir ( & target_compiler, target) ;
159
163
let out_dir = build. cargo_out ( & compiler, Mode :: Libtest , target) ;
160
164
add_to_sysroot ( & out_dir, & libdir) ;
@@ -224,6 +228,12 @@ pub fn rustc_link(build: &Build,
224
228
compiler : & Compiler ,
225
229
target_compiler : & Compiler ,
226
230
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) ;
227
237
let libdir = build. sysroot_libdir ( & target_compiler, target) ;
228
238
let out_dir = build. cargo_out ( & compiler, Mode :: Librustc , target) ;
229
239
add_to_sysroot ( & out_dir, & libdir) ;
0 commit comments