about summary refs log tree commit diff
path: root/src/librustc_back
diff options
context:
space:
mode:
authorJorge Aparicio <japaricious@gmail.com>2016-08-26 21:05:16 -0500
committerJorge Aparicio <japaricious@gmail.com>2016-08-26 21:05:50 -0500
commit027eab2f87d8cd30949e257cb52f520077575ff2 (patch)
tree7a83ac27dd9767f07b3223a69504d68ca922f3b5 /src/librustc_back
parente07dd59eaeb7be95afd2fb3dc131108ae750c91c (diff)
downloadrust-027eab2f87d8cd30949e257cb52f520077575ff2.tar.gz
rust-027eab2f87d8cd30949e257cb52f520077575ff2.zip
initial support for s390x
A new target, `s390x-unknown-linux-gnu`, has been added to the compiler
and can be used to build no_core/no_std Rust programs.

Known limitations:

- librustc_trans/cabi_s390x.rs is missing. This means no support for
  `extern "C" fn`.
- No support for this arch in libc. This means std can be cross compiled
  for this target.
Diffstat (limited to 'src/librustc_back')
-rw-r--r--src/librustc_back/target/mod.rs1
-rw-r--r--src/librustc_back/target/s390x_unknown_linux_gnu.rs30
2 files changed, 31 insertions, 0 deletions
diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs
index 86cd86d282c..86325cfe544 100644
--- a/src/librustc_back/target/mod.rs
+++ b/src/librustc_back/target/mod.rs
@@ -132,6 +132,7 @@ supported_targets! {
     ("powerpc-unknown-linux-gnu", powerpc_unknown_linux_gnu),
     ("powerpc64-unknown-linux-gnu", powerpc64_unknown_linux_gnu),
     ("powerpc64le-unknown-linux-gnu", powerpc64le_unknown_linux_gnu),
+    ("s390x-unknown-linux-gnu", s390x_unknown_linux_gnu),
     ("arm-unknown-linux-gnueabi", arm_unknown_linux_gnueabi),
     ("arm-unknown-linux-gnueabihf", arm_unknown_linux_gnueabihf),
     ("arm-unknown-linux-musleabi", arm_unknown_linux_musleabi),
diff --git a/src/librustc_back/target/s390x_unknown_linux_gnu.rs b/src/librustc_back/target/s390x_unknown_linux_gnu.rs
new file mode 100644
index 00000000000..895d33d8d75
--- /dev/null
+++ b/src/librustc_back/target/s390x_unknown_linux_gnu.rs
@@ -0,0 +1,30 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use target::{Target, TargetResult};
+
+pub fn target() -> TargetResult {
+    let mut base = super::linux_base::opts();
+    // NOTE(zEC12) matches C toolchain
+    base.cpu = "zEC12".to_string();
+    base.max_atomic_width = 64;
+
+    Ok(Target {
+        llvm_target: "s390x-unknown-linux-gnu".to_string(),
+        target_endian: "big".to_string(),
+        target_pointer_width: "64".to_string(),
+        data_layout: "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-a:8:16-n32:64".to_string(),
+        arch: "s390x".to_string(),
+        target_os: "linux".to_string(),
+        target_env: "gnu".to_string(),
+        target_vendor: "unknown".to_string(),
+        options: base,
+    })
+}