File tree 6 files changed +20
-39
lines changed
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;
13
13
use driver:: session;
14
14
use metadata:: loader:: meta_section_name;
15
15
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 {
17
17
return target_strs:: t {
18
18
module_asm: ~"",
19
19
@@ -61,13 +61,7 @@ pub fn get_target_strs(target_os: session::os) -> target_strs::t {
61
61
}
62
62
} ,
63
63
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,
71
65
72
66
cc_args : ~[ ~"-marm"]
73
67
} ;
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ use driver::session;
13
13
use driver:: session:: sess_os_to_meta_os;
14
14
use metadata:: loader:: meta_section_name;
15
15
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 {
17
17
return target_strs:: t {
18
18
module_asm: ~"",
19
19
@@ -61,13 +61,7 @@ pub fn get_target_strs(target_os: session::os) -> target_strs::t {
61
61
}
62
62
} ,
63
63
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,
71
65
72
66
cc_args : ~[ ]
73
67
} ;
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ use driver::session::sess_os_to_meta_os;
14
14
use driver:: session;
15
15
use metadata:: loader:: meta_section_name;
16
16
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 {
18
18
return target_strs:: t {
19
19
module_asm: ~"",
20
20
@@ -44,13 +44,7 @@ pub fn get_target_strs(target_os: session::os) -> target_strs::t {
44
44
}
45
45
} ,
46
46
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,
54
48
55
49
cc_args : ~[ ~"-m32"]
56
50
} ;
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ use driver::session::sess_os_to_meta_os;
14
14
use driver:: session;
15
15
use metadata:: loader:: meta_section_name;
16
16
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 {
18
18
return target_strs:: t {
19
19
module_asm: ~"",
20
20
@@ -52,13 +52,7 @@ pub fn get_target_strs(target_os: session::os) -> target_strs::t {
52
52
}
53
53
} ,
54
54
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,
62
56
63
57
cc_args : ~[ ~"-m64"]
64
58
} ;
Original file line number Diff line number Diff line change @@ -570,11 +570,12 @@ pub fn build_target_config(sopts: @session::options,
570
570
abi::Arm => (ast::ty_i32, ast::ty_u32, ast::ty_f64),
571
571
abi::Mips => (ast::ty_i32, ast::ty_u32, ast::ty_f64)
572
572
};
573
+ let target_triple = sopts.target_triple.clone();
573
574
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)
578
579
};
579
580
let target_cfg = @session::config {
580
581
os: os,
Original file line number Diff line number Diff line change @@ -391,19 +391,23 @@ LLVMRustWriteOutputFile(LLVMPassManagerRef PMR,
391
391
cl::ParseCommandLineOptions (argc, argv);
392
392
}
393
393
394
+ Triple Trip (Triple::normalize (triple));
395
+
394
396
TargetOptions Options;
395
397
Options.EnableSegmentedStacks = EnableSegmentedStacks;
396
398
Options.FixedStackSegmentSize = 2 * 1024 * 1024 ; // XXX: This is too big.
399
+ Options.FloatABIType =
400
+ (Trip.getEnvironment () == Triple::GNUEABIHF) ? FloatABI::Hard :
401
+ FloatABI::Default;
397
402
398
403
PassManager *PM = unwrap<PassManager>(PMR);
399
404
400
405
std::string Err;
401
- std::string Trip (Triple::normalize (triple));
402
406
std::string FeaturesStr (feature);
403
407
std::string CPUStr (cpu);
404
- const Target *TheTarget = TargetRegistry::lookupTarget (Trip, Err);
408
+ const Target *TheTarget = TargetRegistry::lookupTarget (Trip. getTriple () , Err);
405
409
TargetMachine *Target =
406
- TheTarget->createTargetMachine (Trip, CPUStr, FeaturesStr,
410
+ TheTarget->createTargetMachine (Trip. getTriple () , CPUStr, FeaturesStr,
407
411
Options, Reloc::PIC_,
408
412
CodeModel::Default, OptLevel);
409
413
Target->addAnalysisPasses (*PM);
You can’t perform that action at this time.
0 commit comments