@@ -80,6 +80,10 @@ pub struct Build {
8080 package_vers : String ,
8181 bootstrap_key : String ,
8282
83+ // Probed tools at runtime
84+ gdb_version : Option < String > ,
85+ lldb_version : Option < String > ,
86+
8387 // Runtime state filled in later on
8488 cc : HashMap < String , ( gcc:: Tool , PathBuf ) > ,
8589 cxx : HashMap < String , gcc:: Tool > ,
@@ -128,6 +132,8 @@ impl Build {
128132 cc : HashMap :: new ( ) ,
129133 cxx : HashMap :: new ( ) ,
130134 compiler_rt_built : RefCell :: new ( HashMap :: new ( ) ) ,
135+ gdb_version : None ,
136+ lldb_version : None ,
131137 }
132138 }
133139
@@ -160,6 +166,9 @@ impl Build {
160166 CompilerRt { _dummy } => {
161167 native:: compiler_rt ( self , target. target ) ;
162168 }
169+ TestHelpers { _dummy } => {
170+ native:: test_helpers ( self , target. target ) ;
171+ }
163172 Libstd { compiler } => {
164173 compile:: std ( self , target. target , & compiler) ;
165174 }
@@ -197,6 +206,9 @@ impl Build {
197206 ToolCargoTest { stage } => {
198207 compile:: tool ( self , stage, target. target , "cargotest" ) ;
199208 }
209+ ToolCompiletest { stage } => {
210+ compile:: tool ( self , stage, target. target , "compiletest" ) ;
211+ }
200212 DocBook { stage } => {
201213 doc:: rustbook ( self , stage, target. target , "book" , & doc_out) ;
202214 }
@@ -230,12 +242,68 @@ impl Build {
230242 CheckCargoTest { stage } => {
231243 check:: cargotest ( self , stage, target. target ) ;
232244 }
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+ }
233294
234295 DistDocs { stage } => dist:: docs ( self , stage, target. target ) ,
235296 DistMingw { _dummy } => dist:: mingw ( self , target. target ) ,
236297 DistRustc { stage } => dist:: rustc ( self , stage, target. target ) ,
237298 DistStd { compiler } => dist:: std ( self , & compiler, target. target ) ,
238299
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+
239307 Dist { .. } |
240308 Doc { .. } | // pseudo-steps
241309 Check { .. } => { }
@@ -436,7 +504,8 @@ impl Build {
436504 let suffix = match mode {
437505 Mode :: Libstd => "-std" ,
438506 Mode :: Libtest => "-test" ,
439- Mode :: Tool | Mode :: Librustc => "-rustc" ,
507+ Mode :: Tool => "-tools" ,
508+ Mode :: Librustc => "-rustc" ,
440509 } ;
441510 self . out . join ( compiler. host )
442511 . join ( format ! ( "stage{}{}" , compiler. stage, suffix) )
@@ -457,11 +526,39 @@ impl Build {
457526 self . out . join ( target) . join ( "llvm" )
458527 }
459528
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+
460551 /// Root output directory for compiler-rt compiled for `target`
461552 fn compiler_rt_out ( & self , target : & str ) -> PathBuf {
462553 self . out . join ( target) . join ( "compiler-rt" )
463554 }
464555
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+
465562 fn add_rustc_lib_path ( & self , compiler : & Compiler , cmd : & mut Command ) {
466563 // Windows doesn't need dylib path munging because the dlls for the
467564 // compiler live next to the compiler and the system will find them
@@ -504,8 +601,11 @@ impl Build {
504601 }
505602
506603 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.
507606 let mut base = self . cc [ target] . 0 . args ( ) . iter ( )
508607 . map ( |s| s. to_string_lossy ( ) . into_owned ( ) )
608+ . filter ( |s| !s. starts_with ( "-O" ) && !s. starts_with ( "/O" ) )
509609 . collect :: < Vec < _ > > ( ) ;
510610
511611 // If we're compiling on OSX then we add a few unconditional flags
0 commit comments