File tree Expand file tree Collapse file tree 6 files changed +20
-39
lines changed Expand file tree Collapse file tree 6 files changed +20
-39
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ use driver::session::sess_os_to_meta_os;
1313use driver:: session;
1414use metadata:: loader:: meta_section_name;
1515
16- pub fn get_target_strs ( target_os : session:: os ) -> target_strs:: t {
16+ pub fn get_target_strs ( target_triple : ~ str , target_os : session:: os ) -> target_strs:: t {
1717 return target_strs:: t {
1818 module_asm: ~"",
1919
@@ -61,13 +61,7 @@ pub fn get_target_strs(target_os: session::os) -> target_strs::t {
6161 }
6262 } ,
6363
64- target_triple : match target_os {
65- session:: os_macos => ~"arm-apple-darwin",
66- session:: os_win32 => ~"arm-pc-mingw32",
67- session:: os_linux => ~"arm-unknown-linux-gnueabihf",
68- session:: os_android => ~"arm-linux-androideabi",
69- session:: os_freebsd => ~"arm-unknown-freebsd"
70- } ,
64+ target_triple : target_triple,
7165
7266 cc_args : ~[ ~"-marm"]
7367 } ;
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ use driver::session;
1313use driver:: session:: sess_os_to_meta_os;
1414use metadata:: loader:: meta_section_name;
1515
16- pub fn get_target_strs ( target_os : session:: os ) -> target_strs:: t {
16+ pub fn get_target_strs ( target_triple : ~ str , target_os : session:: os ) -> target_strs:: t {
1717 return target_strs:: t {
1818 module_asm: ~"",
1919
@@ -61,13 +61,7 @@ pub fn get_target_strs(target_os: session::os) -> target_strs::t {
6161 }
6262 } ,
6363
64- target_triple : match target_os {
65- session:: os_macos => ~"mips-apple-darwin",
66- session:: os_win32 => ~"mips-pc-mingw32",
67- session:: os_linux => ~"mips-unknown-linux-gnu",
68- session:: os_android => ~"mips-unknown-android-gnu",
69- session:: os_freebsd => ~"mips-unknown-freebsd"
70- } ,
64+ target_triple : target_triple,
7165
7266 cc_args : ~[ ]
7367 } ;
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ use driver::session::sess_os_to_meta_os;
1414use driver:: session;
1515use metadata:: loader:: meta_section_name;
1616
17- pub fn get_target_strs ( target_os : session:: os ) -> target_strs:: t {
17+ pub fn get_target_strs ( target_triple : ~ str , target_os : session:: os ) -> target_strs:: t {
1818 return target_strs:: t {
1919 module_asm: ~"",
2020
@@ -44,13 +44,7 @@ pub fn get_target_strs(target_os: session::os) -> target_strs::t {
4444 }
4545 } ,
4646
47- target_triple : match target_os {
48- session:: os_macos => ~"i686-apple-darwin",
49- session:: os_win32 => ~"i686-pc-mingw32",
50- session:: os_linux => ~"i686-unknown-linux-gnu",
51- session:: os_android => ~"i686-unknown-android-gnu",
52- session:: os_freebsd => ~"i686-unknown-freebsd"
53- } ,
47+ target_triple : target_triple,
5448
5549 cc_args : ~[ ~"-m32"]
5650 } ;
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ use driver::session::sess_os_to_meta_os;
1414use driver:: session;
1515use metadata:: loader:: meta_section_name;
1616
17- pub fn get_target_strs ( target_os : session:: os ) -> target_strs:: t {
17+ pub fn get_target_strs ( target_triple : ~ str , target_os : session:: os ) -> target_strs:: t {
1818 return target_strs:: t {
1919 module_asm: ~"",
2020
@@ -52,13 +52,7 @@ pub fn get_target_strs(target_os: session::os) -> target_strs::t {
5252 }
5353 } ,
5454
55- target_triple : match target_os {
56- session:: os_macos => ~"x86_64-apple-darwin",
57- session:: os_win32 => ~"x86_64-pc-mingw32",
58- session:: os_linux => ~"x86_64-unknown-linux-gnu",
59- session:: os_android => ~"x86_64-unknown-android-gnu",
60- session:: os_freebsd => ~"x86_64-unknown-freebsd",
61- } ,
55+ target_triple : target_triple,
6256
6357 cc_args : ~[ ~"-m64"]
6458 } ;
Original file line number Diff line number Diff line change @@ -570,11 +570,12 @@ pub fn build_target_config(sopts: @session::options,
570570 abi::Arm => (ast::ty_i32, ast::ty_u32, ast::ty_f64),
571571 abi::Mips => (ast::ty_i32, ast::ty_u32, ast::ty_f64)
572572 };
573+ let target_triple = sopts.target_triple.clone();
573574 let target_strs = match arch {
574- abi::X86 => x86::get_target_strs(os),
575- abi::X86_64 => x86_64::get_target_strs(os),
576- abi::Arm => arm::get_target_strs(os),
577- abi::Mips => mips::get_target_strs(os)
575+ abi::X86 => x86::get_target_strs(target_triple, os),
576+ abi::X86_64 => x86_64::get_target_strs(target_triple, os),
577+ abi::Arm => arm::get_target_strs(target_triple, os),
578+ abi::Mips => mips::get_target_strs(target_triple, os)
578579 };
579580 let target_cfg = @session::config {
580581 os: os,
Original file line number Diff line number Diff line change @@ -391,19 +391,23 @@ LLVMRustWriteOutputFile(LLVMPassManagerRef PMR,
391391 cl::ParseCommandLineOptions (argc, argv);
392392 }
393393
394+ Triple Trip (Triple::normalize (triple));
395+
394396 TargetOptions Options;
395397 Options.EnableSegmentedStacks = EnableSegmentedStacks;
396398 Options.FixedStackSegmentSize = 2 * 1024 * 1024 ; // XXX: This is too big.
399+ Options.FloatABIType =
400+ (Trip.getEnvironment () == Triple::GNUEABIHF) ? FloatABI::Hard :
401+ FloatABI::Default;
397402
398403 PassManager *PM = unwrap<PassManager>(PMR);
399404
400405 std::string Err;
401- std::string Trip (Triple::normalize (triple));
402406 std::string FeaturesStr (feature);
403407 std::string CPUStr (cpu);
404- const Target *TheTarget = TargetRegistry::lookupTarget (Trip, Err);
408+ const Target *TheTarget = TargetRegistry::lookupTarget (Trip. getTriple () , Err);
405409 TargetMachine *Target =
406- TheTarget->createTargetMachine (Trip, CPUStr, FeaturesStr,
410+ TheTarget->createTargetMachine (Trip. getTriple () , CPUStr, FeaturesStr,
407411 Options, Reloc::PIC_,
408412 CodeModel::Default, OptLevel);
409413 Target->addAnalysisPasses (*PM);
You can’t perform that action at this time.
0 commit comments