@@ -684,8 +684,9 @@ pub fn build_session_options(binary: @str,
684
684
link:: output_type_bitcode
685
685
} else { link:: output_type_exe } ;
686
686
let sysroot_opt = getopts:: opt_maybe_str ( matches, "sysroot" ) . map_move ( |m| @Path ( m) ) ;
687
- let target_opt = getopts:: opt_maybe_str ( matches, "target" ) ;
688
- let target_feature_opt = getopts:: opt_maybe_str ( matches, "target-feature" ) ;
687
+ let target = getopts:: opt_maybe_str ( matches, "target" ) . unwrap_or_default ( host_triple ( ) ) ;
688
+ let target_cpu = getopts:: opt_maybe_str ( matches, "target-cpu" ) . unwrap_or_default ( ~"generic") ;
689
+ let target_feature = getopts:: opt_maybe_str ( matches, "target-feature" ) . unwrap_or_default ( ~"") ;
689
690
let save_temps = getopts:: opt_present ( matches, "save-temps" ) ;
690
691
let opt_level = {
691
692
if ( debugging_opts & session:: no_opt) != 0 {
@@ -713,15 +714,6 @@ pub fn build_session_options(binary: @str,
713
714
let debuginfo = debugging_opts & session:: debug_info != 0 ||
714
715
extra_debuginfo;
715
716
let statik = debugging_opts & session:: statik != 0 ;
716
- let target =
717
- match target_opt {
718
- None => host_triple ( ) ,
719
- Some ( s) => s
720
- } ;
721
- let target_feature = match target_feature_opt {
722
- None => ~"",
723
- Some ( s) => s
724
- } ;
725
717
726
718
let addl_lib_search_paths = getopts:: opt_strs ( matches, "L" ) . map ( |s| Path ( * s) ) ;
727
719
let linker = getopts:: opt_maybe_str ( matches, "linker" ) ;
@@ -760,6 +752,7 @@ pub fn build_session_options(binary: @str,
760
752
linker_args : linker_args,
761
753
maybe_sysroot : sysroot_opt,
762
754
target_triple : target,
755
+ target_cpu : target_cpu,
763
756
target_feature : target_feature,
764
757
cfg : cfg,
765
758
binary : binary,
@@ -876,10 +869,13 @@ pub fn optgroups() -> ~[getopts::groups::OptGroup] {
876
869
optopt ( "" , "target" ,
877
870
"Target triple cpu-manufacturer-kernel[-os]
878
871
to compile for (see chapter 3.4 of http://www.sourceware.org/autobook/
879
- for detail)" , "TRIPLE" ) ,
872
+ for details)" , "TRIPLE" ) ,
873
+ optopt ( "" , "target-cpu" ,
874
+ "Select target processor (llc -mcpu=help
875
+ for details)" , "CPU" ) ,
880
876
optopt ( "" , "target-feature" ,
881
877
"Target specific attributes (llc -mattr=help
882
- for detail )" , "FEATURE" ) ,
878
+ for details )" , "FEATURE" ) ,
883
879
optopt ( "" , "android-cross-path" ,
884
880
"The path to the Android NDK" , "PATH" ) ,
885
881
optflagopt ( "W" , "warn" ,
0 commit comments