@@ -245,7 +245,7 @@ actual:\n\
245
245
} ;
246
246
// FIXME (#9639): This needs to handle non-utf8 paths
247
247
let mut args = ~[ ~"-",
248
- ~"--no-trans", ~"--lib",
248
+ ~"--no-trans", ~"--crate - type = lib",
249
249
~"--target=" + target,
250
250
~"-L ", config. build_base. as_str( ) . unwrap( ) . to_owned( ) ,
251
251
~"-L ",
@@ -659,7 +659,7 @@ fn compile_test_(config: &config, props: &TestProps,
659
659
// FIXME (#9639): This needs to handle non-utf8 paths
660
660
let link_args = ~[ ~"-L ", aux_dir. as_str ( ) . unwrap ( ) . to_owned ( ) ] ;
661
661
let args = make_compile_args ( config, props, link_args + extra_args,
662
- make_exe_name, testfile) ;
662
+ |a , b| ThisFile ( make_exe_name ( a , b ) ) , testfile) ;
663
663
compose_and_run_compiler ( config, props, testfile, args, None )
664
664
}
665
665
@@ -702,8 +702,12 @@ fn compose_and_run_compiler(
702
702
let abs_ab = config. aux_base . join ( rel_ab. as_slice ( ) ) ;
703
703
let aux_props = load_props ( & abs_ab) ;
704
704
let aux_args =
705
- make_compile_args ( config, & aux_props, ~[ ~"--dylib"] + extra_link_args,
706
- |a, b| make_lib_name ( a, b, testfile) , & abs_ab) ;
705
+ make_compile_args ( config, & aux_props, ~[ ~"--crate -type=dylib"]
706
+ + extra_link_args,
707
+ |a, b| {
708
+ let f = make_lib_name ( a, b, testfile) ;
709
+ ThisDirectory ( f. dir_path ( ) )
710
+ } , & abs_ab) ;
707
711
let auxres = compose_and_run ( config, & abs_ab, aux_args, ~[ ] ,
708
712
config. compile_lib_path , None ) ;
709
713
if !auxres. status . success ( ) {
@@ -741,10 +745,15 @@ fn compose_and_run(config: &config, testfile: &Path,
741
745
prog, args, procenv, input) ;
742
746
}
743
747
748
+ enum TargetLocation {
749
+ ThisFile ( Path ) ,
750
+ ThisDirectory ( Path ) ,
751
+ }
752
+
744
753
fn make_compile_args ( config : & config ,
745
754
props : & TestProps ,
746
755
extras : ~[ ~str ] ,
747
- xform : |& config , & Path | -> Path ,
756
+ xform : |& config , & Path | -> TargetLocation ,
748
757
testfile : & Path )
749
758
-> ProcArgs {
750
759
let xform_file = xform ( config, testfile) ;
@@ -755,10 +764,14 @@ fn make_compile_args(config: &config,
755
764
} ;
756
765
// FIXME (#9639): This needs to handle non-utf8 paths
757
766
let mut args = ~[ testfile. as_str ( ) . unwrap ( ) . to_owned ( ) ,
758
- ~"-o", xform_file. as_str ( ) . unwrap ( ) . to_owned ( ) ,
759
767
~"-L ", config. build_base . as_str ( ) . unwrap ( ) . to_owned ( ) ,
760
768
~"--target=" + target]
761
769
+ extras;
770
+ let path = match xform_file {
771
+ ThisFile(path) => { args.push(~" -o") ; path }
772
+ ThisDirectory ( path) => { args. push ( ~"--out-dir") ; path }
773
+ } ;
774
+ args. push ( path. as_str ( ) . unwrap ( ) . to_owned ( ) ) ;
762
775
args. push_all_move ( split_maybe_args ( & config. rustcflags ) ) ;
763
776
args. push_all_move ( split_maybe_args ( & props. compile_flags ) ) ;
764
777
return ProcArgs { prog : config. rustc_path . as_str ( ) . unwrap ( ) . to_owned ( ) , args : args} ;
@@ -1043,10 +1056,10 @@ fn compile_test_and_save_bitcode(config: &config, props: &TestProps,
1043
1056
let aux_dir = aux_output_dir_name ( config, testfile) ;
1044
1057
// FIXME (#9639): This needs to handle non-utf8 paths
1045
1058
let link_args = ~[ ~"-L ", aux_dir. as_str ( ) . unwrap ( ) . to_owned ( ) ] ;
1046
- let llvm_args = ~[ ~"-c ", ~" --lib", ~"--save-temps"] ;
1059
+ let llvm_args = ~[ ~"--emit=obj ", ~"--crate -type= lib", ~"--save-temps"] ;
1047
1060
let args = make_compile_args ( config, props,
1048
1061
link_args + llvm_args,
1049
- make_o_name, testfile) ;
1062
+ |a , b| ThisFile ( make_o_name ( a , b ) ) , testfile) ;
1050
1063
compose_and_run_compiler ( config, props, testfile, args, None )
1051
1064
}
1052
1065
0 commit comments