]> git.lizzy.rs Git - rust.git/blob - src/librustc/back/arm.rs
Basic iOS support
[rust.git] / src / librustc / back / arm.rs
1 // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 use back::target_strs;
12 use driver::config::cfg_os_to_meta_os;
13 use metadata::loader::meta_section_name;
14 use syntax::abi;
15
16 pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs::t {
17     let cc_args = if target_triple.as_slice().contains("thumb") {
18         vec!("-mthumb".to_string())
19     } else {
20         vec!("-marm".to_string())
21     };
22     return target_strs::t {
23         module_asm: "".to_string(),
24
25         meta_sect_name:
26             meta_section_name(cfg_os_to_meta_os(target_os)).to_string(),
27
28         data_layout: match target_os {
29           abi::OsMacos => {
30             "e-p:32:32:32\
31                 -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
32                 -f32:32:32-f64:64:64\
33                 -v64:64:64-v128:64:128\
34                 -a0:0:64-n32".to_string()
35           }
36
37           abi::OsiOS => {
38             "e-p:32:32:32\
39                 -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
40                 -f32:32:32-f64:64:64\
41                 -v64:64:64-v128:64:128\
42                 -a0:0:64-n32".to_string()
43           }
44
45           abi::OsWin32 => {
46             "e-p:32:32:32\
47                 -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
48                 -f32:32:32-f64:64:64\
49                 -v64:64:64-v128:64:128\
50                 -a0:0:64-n32".to_string()
51           }
52
53           abi::OsLinux => {
54             "e-p:32:32:32\
55                 -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
56                 -f32:32:32-f64:64:64\
57                 -v64:64:64-v128:64:128\
58                 -a0:0:64-n32".to_string()
59           }
60
61           abi::OsAndroid => {
62             "e-p:32:32:32\
63                 -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
64                 -f32:32:32-f64:64:64\
65                 -v64:64:64-v128:64:128\
66                 -a0:0:64-n32".to_string()
67           }
68
69           abi::OsFreebsd => {
70             "e-p:32:32:32\
71                 -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
72                 -f32:32:32-f64:64:64\
73                 -v64:64:64-v128:64:128\
74                 -a0:0:64-n32".to_string()
75           }
76         },
77
78         target_triple: target_triple,
79
80         cc_args: cc_args,
81     };
82 }