]> git.lizzy.rs Git - rust.git/commitdiff
librustc: Always use session target triple.
authorLuqman Aden <laden@csclub.uwaterloo.ca>
Sat, 24 Aug 2013 17:54:42 +0000 (13:54 -0400)
committerLuqman Aden <laden@csclub.uwaterloo.ca>
Sat, 24 Aug 2013 17:54:42 +0000 (13:54 -0400)
src/librustc/back/arm.rs
src/librustc/back/mips.rs
src/librustc/back/x86.rs
src/librustc/back/x86_64.rs
src/librustc/driver/driver.rs

index fc59df8d2489497b00b3000569bd6b5b69870c9e..94f4adb590ab2c8bdc8336dbaf5b0e04cda7f894 100644 (file)
@@ -13,7 +13,7 @@
 use driver::session;
 use metadata::loader::meta_section_name;
 
-pub fn get_target_strs(target_os: session::os) -> target_strs::t {
+pub fn get_target_strs(target_triple: ~str, target_os: session::os) -> target_strs::t {
     return target_strs::t {
         module_asm: ~"",
 
@@ -61,13 +61,7 @@ pub fn get_target_strs(target_os: session::os) -> target_strs::t {
           }
         },
 
-        target_triple: match target_os {
-          session::os_macos => ~"arm-apple-darwin",
-          session::os_win32 => ~"arm-pc-mingw32",
-          session::os_linux => ~"arm-unknown-linux-gnueabihf",
-          session::os_android => ~"arm-linux-androideabi",
-          session::os_freebsd => ~"arm-unknown-freebsd"
-        },
+        target_triple: target_triple,
 
         cc_args: ~[~"-marm"]
     };
index 3409db5aabe3f9cb2cfb90dcb07dbfc6689f9859..e19b3c78623a61ed681fbdfc512ec1401c759b93 100644 (file)
@@ -13,7 +13,7 @@
 use driver::session::sess_os_to_meta_os;
 use metadata::loader::meta_section_name;
 
-pub fn get_target_strs(target_os: session::os) -> target_strs::t {
+pub fn get_target_strs(target_triple: ~str, target_os: session::os) -> target_strs::t {
     return target_strs::t {
         module_asm: ~"",
 
@@ -61,13 +61,7 @@ pub fn get_target_strs(target_os: session::os) -> target_strs::t {
           }
         },
 
-        target_triple: match target_os {
-          session::os_macos => ~"mips-apple-darwin",
-          session::os_win32 => ~"mips-pc-mingw32",
-          session::os_linux => ~"mips-unknown-linux-gnu",
-          session::os_android => ~"mips-unknown-android-gnu",
-          session::os_freebsd => ~"mips-unknown-freebsd"
-        },
+        target_triple: target_triple,
 
         cc_args: ~[]
     };
index c5dbbf8f028dba1b9ffd5703ca44f3b7437546d4..968c5ba161b1de1cf64393be5db7d2b626af8aef 100644 (file)
@@ -14,7 +14,7 @@
 use driver::session;
 use metadata::loader::meta_section_name;
 
-pub fn get_target_strs(target_os: session::os) -> target_strs::t {
+pub fn get_target_strs(target_triple: ~str, target_os: session::os) -> target_strs::t {
     return target_strs::t {
         module_asm: ~"",
 
@@ -44,13 +44,7 @@ pub fn get_target_strs(target_os: session::os) -> target_strs::t {
           }
         },
 
-        target_triple: match target_os {
-          session::os_macos => ~"i686-apple-darwin",
-          session::os_win32 => ~"i686-pc-mingw32",
-          session::os_linux => ~"i686-unknown-linux-gnu",
-          session::os_android => ~"i686-unknown-android-gnu",
-          session::os_freebsd => ~"i686-unknown-freebsd"
-        },
+        target_triple: target_triple,
 
         cc_args: ~[~"-m32"]
     };
index 42420094e1767926a4a2988e351a1c9d701891fc..87aad7a108cebbf5e3c55d1b0c8f1eca1a651c62 100644 (file)
@@ -14,7 +14,7 @@
 use driver::session;
 use metadata::loader::meta_section_name;
 
-pub fn get_target_strs(target_os: session::os) -> target_strs::t {
+pub fn get_target_strs(target_triple: ~str, target_os: session::os) -> target_strs::t {
     return target_strs::t {
         module_asm: ~"",
 
@@ -52,13 +52,7 @@ pub fn get_target_strs(target_os: session::os) -> target_strs::t {
           }
         },
 
-        target_triple: match target_os {
-          session::os_macos => ~"x86_64-apple-darwin",
-          session::os_win32 => ~"x86_64-pc-mingw32",
-          session::os_linux => ~"x86_64-unknown-linux-gnu",
-          session::os_android => ~"x86_64-unknown-android-gnu",
-          session::os_freebsd => ~"x86_64-unknown-freebsd",
-        },
+        target_triple: target_triple,
 
         cc_args: ~[~"-m64"]
     };
index ca3247db669cb3210cdca66084d6f50258888076..e0c5a729b3f88116804e629eb3c7df6b9d890cdc 100644 (file)
@@ -570,11 +570,12 @@ pub fn build_target_config(sopts: @session::options,
       abi::Arm => (ast::ty_i32, ast::ty_u32, ast::ty_f64),
       abi::Mips => (ast::ty_i32, ast::ty_u32, ast::ty_f64)
     };
+    let target_triple = sopts.target_triple.clone();
     let target_strs = match arch {
-      abi::X86 => x86::get_target_strs(os),
-      abi::X86_64 => x86_64::get_target_strs(os),
-      abi::Arm => arm::get_target_strs(os),
-      abi::Mips => mips::get_target_strs(os)
+      abi::X86 => x86::get_target_strs(target_triple, os),
+      abi::X86_64 => x86_64::get_target_strs(target_triple, os),
+      abi::Arm => arm::get_target_strs(target_triple, os),
+      abi::Mips => mips::get_target_strs(target_triple, os)
     };
     let target_cfg = @session::config {
         os: os,