@@ -80,6 +80,10 @@ pub struct Build {
80
80
package_vers : String ,
81
81
bootstrap_key : String ,
82
82
83
+ // Probed tools at runtime
84
+ gdb_version : Option < String > ,
85
+ lldb_version : Option < String > ,
86
+
83
87
// Runtime state filled in later on
84
88
cc : HashMap < String , ( gcc:: Tool , PathBuf ) > ,
85
89
cxx : HashMap < String , gcc:: Tool > ,
@@ -128,6 +132,8 @@ impl Build {
128
132
cc : HashMap :: new ( ) ,
129
133
cxx : HashMap :: new ( ) ,
130
134
compiler_rt_built : RefCell :: new ( HashMap :: new ( ) ) ,
135
+ gdb_version : None ,
136
+ lldb_version : None ,
131
137
}
132
138
}
133
139
@@ -160,6 +166,9 @@ impl Build {
160
166
CompilerRt { _dummy } => {
161
167
native:: compiler_rt ( self , target. target ) ;
162
168
}
169
+ TestHelpers { _dummy } => {
170
+ native:: test_helpers ( self , target. target ) ;
171
+ }
163
172
Libstd { compiler } => {
164
173
compile:: std ( self , target. target , & compiler) ;
165
174
}
@@ -197,6 +206,9 @@ impl Build {
197
206
ToolCargoTest { stage } => {
198
207
compile:: tool ( self , stage, target. target , "cargotest" ) ;
199
208
}
209
+ ToolCompiletest { stage } => {
210
+ compile:: tool ( self , stage, target. target , "compiletest" ) ;
211
+ }
200
212
DocBook { stage } => {
201
213
doc:: rustbook ( self , stage, target. target , "book" , & doc_out) ;
202
214
}
@@ -230,12 +242,68 @@ impl Build {
230
242
CheckCargoTest { stage } => {
231
243
check:: cargotest ( self , stage, target. target ) ;
232
244
}
245
+ CheckRPass { compiler } => {
246
+ check:: compiletest ( self , & compiler, target. target ,
247
+ "run-pass" , "run-pass" ) ;
248
+ }
249
+ CheckCFail { compiler } => {
250
+ check:: compiletest ( self , & compiler, target. target ,
251
+ "compile-fail" , "compile-fail" ) ;
252
+ }
253
+ CheckPFail { compiler } => {
254
+ check:: compiletest ( self , & compiler, target. target ,
255
+ "parse-fail" , "parse-fail" ) ;
256
+ }
257
+ CheckRFail { compiler } => {
258
+ check:: compiletest ( self , & compiler, target. target ,
259
+ "run-fail" , "run-fail" ) ;
260
+ }
261
+ CheckPretty { compiler } => {
262
+ check:: compiletest ( self , & compiler, target. target ,
263
+ "pretty" , "pretty" ) ;
264
+ }
265
+ CheckCodegen { compiler } => {
266
+ check:: compiletest ( self , & compiler, target. target ,
267
+ "codegen" , "codegen" ) ;
268
+ }
269
+ CheckCodegenUnits { compiler } => {
270
+ check:: compiletest ( self , & compiler, target. target ,
271
+ "codegen-units" , "codegen-units" ) ;
272
+ }
273
+ CheckDebuginfo { compiler } => {
274
+ // TODO: select between gdb/lldb
275
+ check:: compiletest ( self , & compiler, target. target ,
276
+ "debuginfo-gdb" , "debuginfo" ) ;
277
+ }
278
+ CheckRustdoc { compiler } => {
279
+ check:: compiletest ( self , & compiler, target. target ,
280
+ "rustdoc" , "rustdoc" ) ;
281
+ }
282
+ CheckRPassValgrind { compiler } => {
283
+ check:: compiletest ( self , & compiler, target. target ,
284
+ "run-pass-valgrind" , "run-pass-valgrind" ) ;
285
+ }
286
+ CheckRPassFull { compiler } => {
287
+ check:: compiletest ( self , & compiler, target. target ,
288
+ "run-pass" , "run-pass-fulldeps" ) ;
289
+ }
290
+ CheckCFailFull { compiler } => {
291
+ check:: compiletest ( self , & compiler, target. target ,
292
+ "compile-fail" , "compile-fail-fulldeps" )
293
+ }
233
294
234
295
DistDocs { stage } => dist:: docs ( self , stage, target. target ) ,
235
296
DistMingw { _dummy } => dist:: mingw ( self , target. target ) ,
236
297
DistRustc { stage } => dist:: rustc ( self , stage, target. target ) ,
237
298
DistStd { compiler } => dist:: std ( self , & compiler, target. target ) ,
238
299
300
+ DebuggerScripts { stage } => {
301
+ let compiler = Compiler :: new ( stage, target. target ) ;
302
+ dist:: debugger_scripts ( self ,
303
+ & self . sysroot ( & compiler) ,
304
+ target. target ) ;
305
+ }
306
+
239
307
Dist { .. } |
240
308
Doc { .. } | // pseudo-steps
241
309
Check { .. } => { }
@@ -436,7 +504,8 @@ impl Build {
436
504
let suffix = match mode {
437
505
Mode :: Libstd => "-std" ,
438
506
Mode :: Libtest => "-test" ,
439
- Mode :: Tool | Mode :: Librustc => "-rustc" ,
507
+ Mode :: Tool => "-tools" ,
508
+ Mode :: Librustc => "-rustc" ,
440
509
} ;
441
510
self . out . join ( compiler. host )
442
511
. join ( format ! ( "stage{}{}" , compiler. stage, suffix) )
@@ -457,11 +526,39 @@ impl Build {
457
526
self . out . join ( target) . join ( "llvm" )
458
527
}
459
528
529
+ /// Returns the path to `llvm-config` for the specified target
530
+ fn llvm_config ( & self , target : & str ) -> PathBuf {
531
+ let target_config = self . config . target_config . get ( target) ;
532
+ if let Some ( s) = target_config. and_then ( |c| c. llvm_config . as_ref ( ) ) {
533
+ s. clone ( )
534
+ } else {
535
+ self . llvm_out ( & self . config . build ) . join ( "bin" )
536
+ . join ( exe ( "llvm-config" , target) )
537
+ }
538
+ }
539
+
540
+ /// Returns the path to `llvm-config` for the specified target
541
+ fn llvm_filecheck ( & self , target : & str ) -> PathBuf {
542
+ let target_config = self . config . target_config . get ( target) ;
543
+ if let Some ( s) = target_config. and_then ( |c| c. llvm_config . as_ref ( ) ) {
544
+ s. parent ( ) . unwrap ( ) . join ( exe ( "FileCheck" , target) )
545
+ } else {
546
+ self . llvm_out ( & self . config . build ) . join ( "build/bin" )
547
+ . join ( exe ( "FileCheck" , target) )
548
+ }
549
+ }
550
+
460
551
/// Root output directory for compiler-rt compiled for `target`
461
552
fn compiler_rt_out ( & self , target : & str ) -> PathBuf {
462
553
self . out . join ( target) . join ( "compiler-rt" )
463
554
}
464
555
556
+ /// Root output directory for rust_test_helpers library compiled for
557
+ /// `target`
558
+ fn test_helpers_out ( & self , target : & str ) -> PathBuf {
559
+ self . out . join ( target) . join ( "rust-test-helpers" )
560
+ }
561
+
465
562
fn add_rustc_lib_path ( & self , compiler : & Compiler , cmd : & mut Command ) {
466
563
// Windows doesn't need dylib path munging because the dlls for the
467
564
// compiler live next to the compiler and the system will find them
@@ -504,8 +601,11 @@ impl Build {
504
601
}
505
602
506
603
fn cflags ( & self , target : & str ) -> Vec < String > {
604
+ // Filter out -O and /O (the optimization flags) that we picked up from
605
+ // gcc-rs because the build scripts will determine that for themselves.
507
606
let mut base = self . cc [ target] . 0 . args ( ) . iter ( )
508
607
. map ( |s| s. to_string_lossy ( ) . into_owned ( ) )
608
+ . filter ( |s| !s. starts_with ( "-O" ) && !s. starts_with ( "/O" ) )
509
609
. collect :: < Vec < _ > > ( ) ;
510
610
511
611
// If we're compiling on OSX then we add a few unconditional flags
0 commit comments