about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorkyeongwoon <kyeongwoon.lee@samsung.com>2012-11-30 09:21:49 +0900
committerBrian Anderson <banderson@mozilla.com>2013-01-13 16:43:39 -0800
commit987f824f233faee4aed39dac92a1b442d42965cc (patch)
tree2cf1b078738e9bf580b9ee43f674d95c403751fa /src/libcore
parent27e6a0fa5651dbda55773488c8b706adfa5cefc2 (diff)
downloadrust-987f824f233faee4aed39dac92a1b442d42965cc.tar.gz
rust-987f824f233faee4aed39dac92a1b442d42965cc.zip
Support ARM and Android
Conflicts:
	src/libcore/os.rs
	src/librustc/back/link.rs
	src/librustc/driver/driver.rs
	src/librustc/metadata/loader.rs
	src/librustc/middle/trans/base.rs
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/cleanup.rs3
-rw-r--r--src/libcore/libc.rs14
-rw-r--r--src/libcore/os.rs14
-rw-r--r--src/libcore/path.rs2
-rw-r--r--src/libcore/run.rs2
5 files changed, 33 insertions, 2 deletions
diff --git a/src/libcore/cleanup.rs b/src/libcore/cleanup.rs
index c8b96b9b23b..656f672479e 100644
--- a/src/libcore/cleanup.rs
+++ b/src/libcore/cleanup.rs
@@ -40,11 +40,13 @@ struct AllocHeader { priv opaque: () }
 struct MemoryRegion { priv opaque: () }
 
 #[cfg(target_arch="x86")]
+#[cfg(target_arch="arm")]
 struct Registers {
     data: [u32 * 16]
 }
 
 #[cfg(target_arch="x86")]
+#[cfg(target_arch="arm")]
 struct Context {
     regs: Registers,
     next: *Context,
@@ -70,6 +72,7 @@ struct BoxedRegion {
 }
 
 #[cfg(target_arch="x86")]
+#[cfg(target_arch="arm")]
 struct Task {
     // Public fields
     refcount: intptr_t,                 // 0
diff --git a/src/libcore/libc.rs b/src/libcore/libc.rs
index cc9e4d1c5a9..ecd48fe16bc 100644
--- a/src/libcore/libc.rs
+++ b/src/libcore/libc.rs
@@ -198,12 +198,14 @@ pub mod types {
     // Standard types that are scalar but vary by OS and arch.
 
     #[cfg(target_os = "linux")]
+    #[cfg(target_os = "android")]
     pub mod os {
         pub mod common {
             pub mod posix01 {}
         }
 
         #[cfg(target_arch = "x86")]
+        #[cfg(target_arch = "arm")]
         pub mod arch {
             pub mod c95 {
                 pub type c_char = i8;
@@ -797,6 +799,7 @@ pub mod consts {
 
 
     #[cfg(target_os = "linux")]
+    #[cfg(target_os = "android")]
     pub mod os {
         pub mod c95 {
             pub const EXIT_FAILURE : int = 1;
@@ -1264,6 +1267,7 @@ pub mod funcs {
 
 
     #[cfg(target_os = "linux")]
+    #[cfg(target_os = "android")]
     #[cfg(target_os = "macos")]
     #[cfg(target_os = "freebsd")]
     pub mod posix88 {
@@ -1283,7 +1287,8 @@ pub mod funcs {
 
             #[cfg(target_os = "linux")]
             #[cfg(target_os = "freebsd")]
-            unsafe fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
+            #[cfg(target_os = "android")]
+           unsafe fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
 
             #[cfg(target_os = "macos")]
             #[link_name = "fstat64"]
@@ -1294,6 +1299,7 @@ pub mod funcs {
 
             #[cfg(target_os = "linux")]
             #[cfg(target_os = "freebsd")]
+            #[cfg(target_os = "android")]
             unsafe fn stat(path: *c_char, buf: *mut stat) -> c_int;
 
             #[cfg(target_os = "macos")]
@@ -1382,6 +1388,7 @@ pub mod funcs {
     }
 
     #[cfg(target_os = "linux")]
+    #[cfg(target_os = "android")]
     #[cfg(target_os = "macos")]
     #[cfg(target_os = "freebsd")]
     pub mod posix01 {
@@ -1394,6 +1401,7 @@ pub mod funcs {
         pub extern mod stat_ {
             #[cfg(target_os = "linux")]
             #[cfg(target_os = "freebsd")]
+            #[cfg(target_os = "android")]
             unsafe fn lstat(path: *c_char, buf: *mut stat) -> c_int;
 
             #[cfg(target_os = "macos")]
@@ -1410,6 +1418,7 @@ pub mod funcs {
             unsafe fn fsync(fd: c_int) -> c_int;
 
             #[cfg(target_os = "linux")]
+            #[cfg(target_os = "android")]
             unsafe fn fdatasync(fd: c_int) -> c_int;
 
             unsafe fn setenv(name: *c_char, val: *c_char,
@@ -1442,6 +1451,7 @@ pub mod funcs {
 
     #[cfg(target_os = "win32")]
     #[cfg(target_os = "linux")]
+    #[cfg(target_os = "android")]
     #[cfg(target_os = "macos")]
     #[cfg(target_os = "freebsd")]
     pub mod posix08 {
@@ -1473,6 +1483,7 @@ pub mod funcs {
 
 
     #[cfg(target_os = "linux")]
+    #[cfg(target_os = "android")]
     #[cfg(target_os = "win32")]
     pub mod bsd44 {
     }
@@ -1492,6 +1503,7 @@ pub mod funcs {
     }
 
     #[cfg(target_os = "linux")]
+    #[cfg(target_os = "android")]
     pub mod extra {
     }
 
diff --git a/src/libcore/os.rs b/src/libcore/os.rs
index f602b230f45..ff3253a8223 100644
--- a/src/libcore/os.rs
+++ b/src/libcore/os.rs
@@ -325,6 +325,7 @@ pub fn fsync_fd(fd: c_int, _level: io::fsync::Level) -> c_int {
 }
 
 #[cfg(target_os = "linux")]
+#[cfg(target_os = "android")]
 pub fn fsync_fd(fd: c_int, level: io::fsync::Level) -> c_int {
     unsafe {
         use libc::funcs::posix01::unistd::*;
@@ -449,6 +450,7 @@ pub fn self_exe_path() -> Option<Path> {
     }
 
     #[cfg(target_os = "linux")]
+    #[cfg(target_os = "android")]
     fn load_self() -> Option<~str> {
         unsafe {
             use libc::funcs::posix01::unistd::readlink;
@@ -876,6 +878,7 @@ pub fn real_args() -> ~[~str] {
 }
 
 #[cfg(target_os = "linux")]
+#[cfg(target_os = "android")]
 #[cfg(target_os = "freebsd")]
 pub fn real_args() -> ~[~str] {
     unsafe {
@@ -976,7 +979,6 @@ pub mod consts {
         pub const FAMILY: &str = "windows";
     }
 
-
     #[cfg(target_os = "macos")]
     use os::consts::macos::*;
 
@@ -986,6 +988,9 @@ pub mod consts {
     #[cfg(target_os = "linux")]
     use os::consts::linux::*;
 
+    #[cfg(target_os = "android")]
+    use os::consts::android::*;
+
     #[cfg(target_os = "win32")]
     use os::consts::win32::*;
 
@@ -1010,6 +1015,13 @@ pub mod consts {
         pub const EXE_SUFFIX: &str = "";
     }
 
+    pub mod android {
+        pub const SYSNAME: &str = "android";
+        pub const DLL_PREFIX: &str = "lib";
+        pub const DLL_SUFFIX: &str = ".so";
+        pub const EXE_SUFFIX: &str = "";
+    }
+
     pub mod win32 {
         pub const SYSNAME: &str = "win32";
         pub const DLL_PREFIX: &str = "";
diff --git a/src/libcore/path.rs b/src/libcore/path.rs
index cf1188b1f35..7f5f334ac1f 100644
--- a/src/libcore/path.rs
+++ b/src/libcore/path.rs
@@ -89,8 +89,10 @@ pub pure fn Path(s: &str) -> Path {
 }
 
 #[cfg(target_os = "linux")]
+#[cfg(target_os = "android")]
 mod stat {
     #[cfg(target_arch = "x86")]
+    #[cfg(target_arch = "arm")]
     pub mod arch {
         use libc;
 
diff --git a/src/libcore/run.rs b/src/libcore/run.rs
index 435feb16023..54bce77d308 100644
--- a/src/libcore/run.rs
+++ b/src/libcore/run.rs
@@ -405,6 +405,7 @@ pub fn waitpid(pid: pid_t) -> int {
     #[cfg(unix)]
     fn waitpid_os(pid: pid_t) -> int {
         #[cfg(target_os = "linux")]
+        #[cfg(target_os = "android")]
         fn WIFEXITED(status: i32) -> bool {
             (status & 0xffi32) == 0i32
         }
@@ -416,6 +417,7 @@ pub fn waitpid(pid: pid_t) -> int {
         }
 
         #[cfg(target_os = "linux")]
+        #[cfg(target_os = "android")]
         fn WEXITSTATUS(status: i32) -> i32 {
             (status >> 8i32) & 0xffi32
         }