Skip to content

Commit 6a05aa6

Browse files
committed
librustc: Always use session target triple.
1 parent cfd0bfb commit 6a05aa6

File tree

5 files changed

+13
-36
lines changed

5 files changed

+13
-36
lines changed

src/librustc/back/arm.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use driver::session::sess_os_to_meta_os;
1313
use driver::session;
1414
use 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
};

src/librustc/back/mips.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use driver::session;
1313
use driver::session::sess_os_to_meta_os;
1414
use 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
};

src/librustc/back/x86.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use driver::session::sess_os_to_meta_os;
1414
use driver::session;
1515
use 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
};

src/librustc/back/x86_64.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use driver::session::sess_os_to_meta_os;
1414
use driver::session;
1515
use 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
};

src/librustc/driver/driver.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff 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,

0 commit comments

Comments
 (0)