about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorValerii Hiora <valerii.hiora@gmail.com>2015-01-09 18:25:01 +0200
committerValerii Hiora <valerii.hiora@gmail.com>2015-01-09 18:38:30 +0200
commit577d0dbcb88a53e45e5c24c3a9a2e1c22acd31aa (patch)
tree77380277fa1f179b1925c919c626320018547010 /src
parent3fbbc6ea2ac923b7d87e152129544e8fc90511f2 (diff)
downloadrust-577d0dbcb88a53e45e5c24c3a9a2e1c22acd31aa.tar.gz
rust-577d0dbcb88a53e45e5c24c3a9a2e1c22acd31aa.zip
iOS: preliminary 64-bit archs support
Diffstat (limited to 'src')
-rw-r--r--src/liblibc/lib.rs2
-rw-r--r--src/librustc_back/target/aarch64_apple_ios.rs31
-rw-r--r--src/librustc_back/target/mod.rs4
-rw-r--r--src/librustc_back/target/x86_64_apple_ios.rs26
-rw-r--r--src/libstd/sys/unix/sync.rs9
-rw-r--r--src/rt/arch/aarch64/morestack.S26
6 files changed, 89 insertions, 9 deletions
diff --git a/src/liblibc/lib.rs b/src/liblibc/lib.rs
index c39fd074387..9424800324a 100644
--- a/src/liblibc/lib.rs
+++ b/src/liblibc/lib.rs
@@ -1968,7 +1968,7 @@ pub mod types {
             }
         }
 
-        #[cfg(target_arch = "x86_64")]
+        #[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
         pub mod arch {
             pub mod c95 {
                 pub type c_char = i8;
diff --git a/src/librustc_back/target/aarch64_apple_ios.rs b/src/librustc_back/target/aarch64_apple_ios.rs
new file mode 100644
index 00000000000..2ceb34e68b7
--- /dev/null
+++ b/src/librustc_back/target/aarch64_apple_ios.rs
@@ -0,0 +1,31 @@
+// Copyright 2014 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, TargetOptions};
+use super::apple_ios_base::{opts, Arch};
+
+pub fn target() -> Target {
+    Target {
+        // reference layout: e-m:o-i64:64-i128:128-n32:64-S128
+        data_layout: "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\
+                      i128:128-f32:32:32-f64:64:64-v64:64:64-v128:128:128-\
+                      a:0:64-n32:64-S128".to_string(),
+        llvm_target: "arm64-apple-ios".to_string(),
+        target_endian: "little".to_string(),
+        target_pointer_width: "64".to_string(),
+        arch: "aarch64".to_string(),
+        target_os: "ios".to_string(),
+        options: TargetOptions {
+            features: "+neon,+fp-armv8,+cyclone".to_string(),
+            eliminate_frame_pointer: false,
+            .. opts(Arch::Arm64)
+        },
+    }
+}
diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs
index b4a9a3c5f41..57e2744ae9b 100644
--- a/src/librustc_back/target/mod.rs
+++ b/src/librustc_back/target/mod.rs
@@ -64,6 +64,7 @@ mod i386_apple_ios;
 mod arm_linux_androideabi;
 mod arm_unknown_linux_gnueabi;
 mod arm_unknown_linux_gnueabihf;
+mod aarch64_apple_ios;
 mod aarch64_unknown_linux_gnu;
 mod i686_apple_darwin;
 mod i686_pc_windows_gnu;
@@ -72,6 +73,7 @@ mod i686_unknown_linux_gnu;
 mod mips_unknown_linux_gnu;
 mod mipsel_unknown_linux_gnu;
 mod x86_64_apple_darwin;
+mod x86_64_apple_ios;
 mod x86_64_pc_windows_gnu;
 mod x86_64_unknown_freebsd;
 mod x86_64_unknown_dragonfly;
@@ -351,6 +353,8 @@ impl Target {
             i686_apple_darwin,
 
             i386_apple_ios,
+            x86_64_apple_ios,
+            aarch64_apple_ios,
             armv7_apple_ios,
             armv7s_apple_ios,
 
diff --git a/src/librustc_back/target/x86_64_apple_ios.rs b/src/librustc_back/target/x86_64_apple_ios.rs
new file mode 100644
index 00000000000..9df2ccca500
--- /dev/null
+++ b/src/librustc_back/target/x86_64_apple_ios.rs
@@ -0,0 +1,26 @@
+// Copyright 2014 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;
+use super::apple_ios_base::{opts, Arch};
+
+pub fn target() -> Target {
+    Target {
+        data_layout: "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\
+                      f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-\
+                      s0:64:64-f80:128:128-n8:16:32:64".to_string(),
+        llvm_target: "x86_64-apple-ios".to_string(),
+        target_endian: "little".to_string(),
+        target_pointer_width: "64".to_string(),
+        arch: "x86_64".to_string(),
+        target_os: "ios".to_string(),
+        options: opts(Arch::X86_64)
+    }
+}
diff --git a/src/libstd/sys/unix/sync.rs b/src/libstd/sys/unix/sync.rs
index 1d8a59dbbb3..fbbdee1009d 100644
--- a/src/libstd/sys/unix/sync.rs
+++ b/src/libstd/sys/unix/sync.rs
@@ -61,19 +61,22 @@ mod os {
 mod os {
     use libc;
 
-    #[cfg(target_arch = "x86_64")]
+    #[cfg(any(target_arch = "x86_64",
+              target_arch = "aarch64"))]
     const __PTHREAD_MUTEX_SIZE__: uint = 56;
     #[cfg(any(target_arch = "x86",
               target_arch = "arm"))]
     const __PTHREAD_MUTEX_SIZE__: uint = 40;
 
-    #[cfg(target_arch = "x86_64")]
+    #[cfg(any(target_arch = "x86_64",
+              target_arch = "aarch64"))]
     const __PTHREAD_COND_SIZE__: uint = 40;
     #[cfg(any(target_arch = "x86",
               target_arch = "arm"))]
     const __PTHREAD_COND_SIZE__: uint = 24;
 
-    #[cfg(target_arch = "x86_64")]
+    #[cfg(any(target_arch = "x86_64",
+              target_arch = "aarch64"))]
     const __PTHREAD_RWLOCK_SIZE__: uint = 192;
     #[cfg(any(target_arch = "x86",
               target_arch = "arm"))]
diff --git a/src/rt/arch/aarch64/morestack.S b/src/rt/arch/aarch64/morestack.S
index 12827cea0fe..772b8467014 100644
--- a/src/rt/arch/aarch64/morestack.S
+++ b/src/rt/arch/aarch64/morestack.S
@@ -7,13 +7,29 @@
 
 /* See i386/morestack.S for the lengthy, general explanation. */
 
-.global rust_stack_exhausted
+#if defined(__APPLE__)
+#define MORESTACK ___morestack
+#define STACK_EXHAUSTED _rust_stack_exhausted
+#else
+#define MORESTACK __morestack
+#define STACK_EXHAUSTED rust_stack_exhausted
+#endif
+
+.global STACK_EXHAUSTED
+
+#if defined(__APPLE__)
+.private_extern MORESTACK
+#else
+.hidden MORESTACK
+#endif
+
+#if !defined(__APPLE__)
+.type MORESTACK,%function
+#endif
 
 // FIXME(AARCH64): this might not be perfectly right but works for now
-func	__morestack
+MORESTACK:
 	.cfi_startproc
-	bl rust_stack_exhausted
+	bl STACK_EXHAUSTED@plt
 	// the above function ensures that it never returns
 	.cfi_endproc
-endfunc	__morestack
-	.hidden __morestack