@@ -32,6 +32,19 @@ macro_rules! targets {
32
32
( libstd, Libstd { stage: u32 , compiler: Compiler <' a> } ) ,
33
33
( librustc, Librustc { stage: u32 , compiler: Compiler <' a> } ) ,
34
34
35
+ // Links the standard library/librustc produced by the compiler
36
+ // provided into the host's directory also provided.
37
+ ( libstd_link, LibstdLink {
38
+ stage: u32 ,
39
+ compiler: Compiler <' a>,
40
+ host: & ' a str
41
+ } ) ,
42
+ ( librustc_link, LibrustcLink {
43
+ stage: u32 ,
44
+ compiler: Compiler <' a>,
45
+ host: & ' a str
46
+ } ) ,
47
+
35
48
// Steps for long-running native builds. Ideally these wouldn't
36
49
// actually exist and would be part of build scripts, but for now
37
50
// these are here.
@@ -107,13 +120,25 @@ fn top_level(build: &Build) -> Vec<Step> {
107
120
continue
108
121
}
109
122
let host = t. target ( host) ;
110
- targets. push ( host. librustc ( stage, t. compiler ( stage) ) ) ;
123
+ if host. target == build. config . build {
124
+ targets. push ( host. librustc ( stage, host. compiler ( stage) ) ) ;
125
+ } else {
126
+ targets. push ( host. librustc_link ( stage, t. compiler ( stage) ,
127
+ host. target ) ) ;
128
+ }
111
129
for target in build. config . target . iter ( ) {
112
130
if !build. flags . target . contains ( target) {
113
131
continue
114
132
}
115
- targets. push ( host. target ( target)
116
- . libstd ( stage, t. compiler ( stage) ) ) ;
133
+
134
+ if host. target == build. config . build {
135
+ targets. push ( host. target ( target)
136
+ . libstd ( stage, host. compiler ( stage) ) ) ;
137
+ } else {
138
+ targets. push ( host. target ( target)
139
+ . libstd_link ( stage, t. compiler ( stage) ,
140
+ host. target ) ) ;
141
+ }
117
142
}
118
143
}
119
144
}
@@ -128,10 +153,14 @@ fn add_steps<'a>(build: &'a Build,
128
153
target : & Step < ' a > ,
129
154
targets : & mut Vec < Step < ' a > > ) {
130
155
for step in build. flags . step . iter ( ) {
131
- let compiler = host. compiler ( stage) ;
156
+ let compiler = host. target ( & build . config . build ) . compiler ( stage) ;
132
157
match & step[ ..] {
133
158
"libstd" => targets. push ( target. libstd ( stage, compiler) ) ,
134
159
"librustc" => targets. push ( target. librustc ( stage, compiler) ) ,
160
+ "libstd-link" => targets. push ( target. libstd_link ( stage, compiler,
161
+ host. target ) ) ,
162
+ "librustc-link" => targets. push ( target. librustc_link ( stage, compiler,
163
+ host. target ) ) ,
135
164
"rustc" => targets. push ( host. rustc ( stage) ) ,
136
165
"llvm" => targets. push ( target. llvm ( ( ) ) ) ,
137
166
"compiler-rt" => targets. push ( target. compiler_rt ( ( ) ) ) ,
@@ -179,6 +208,14 @@ impl<'a> Step<'a> {
179
208
vec ! [ self . compiler_rt( ( ) ) ,
180
209
self . rustc( compiler. stage) . target( compiler. host) ]
181
210
}
211
+ Source :: LibrustcLink { stage, compiler, host } => {
212
+ vec ! [ self . librustc( stage, compiler) ,
213
+ self . libstd_link( stage, compiler, host) ]
214
+ }
215
+ Source :: LibstdLink { stage, compiler, host } => {
216
+ vec ! [ self . libstd( stage, compiler) ,
217
+ self . target( host) . rustc( stage) ]
218
+ }
182
219
Source :: CompilerRt { _dummy } => {
183
220
vec ! [ self . llvm( ( ) ) . target( & build. config. build) ]
184
221
}
0 commit comments