about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorJyun-Yan You <jyyou@cs.nctu.edu.tw>2014-03-13 14:35:24 +0800
committerJyun-Yan You <jyyou@cs.nctu.edu.tw>2014-03-14 11:13:36 +0800
commit6d7e86d099cf33821398731f750b36df564ca5d2 (patch)
tree4cf087332b5466b6fcc10edf8027cf04add6c166 /src/libstd
parentb4d324334cb48198c27d782002d75eba14a6abde (diff)
downloadrust-6d7e86d099cf33821398731f750b36df564ca5d2.tar.gz
rust-6d7e86d099cf33821398731f750b36df564ca5d2.zip
fix MIPS target
I ignored AtomicU64 methods on MIPS target
because libgcc doesn't implement MIPS32 64-bit atomic operations.
Otherwise it would cause link failure.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/libc.rs25
-rw-r--r--src/libstd/rt/libunwind.rs3
-rw-r--r--src/libstd/sync/atomics.rs4
-rw-r--r--src/libstd/unstable/mutex.rs4
4 files changed, 23 insertions, 13 deletions
diff --git a/src/libstd/libc.rs b/src/libstd/libc.rs
index c602c2fc27f..dd7f8379e7b 100644
--- a/src/libstd/libc.rs
+++ b/src/libstd/libc.rs
@@ -2133,7 +2133,7 @@ pub mod consts {
             pub static MAP_SHARED : c_int = 0x0001;
             pub static MAP_PRIVATE : c_int = 0x0002;
             pub static MAP_FIXED : c_int = 0x0010;
-            pub static MAP_ANON : c_int = 0x0020;
+            pub static MAP_ANON : c_int = 0x0800;
 
             pub static MAP_FAILED : *c_void = -1 as *c_void;
 
@@ -2425,20 +2425,19 @@ pub mod consts {
             pub static O_DSYNC : c_int = 16;
             pub static O_SYNC : c_int = 16400;
 
-            pub static PROT_GROWSDOWN : c_int = 0x010000000;
-            pub static PROT_GROWSUP : c_int = 0x020000000;
+            pub static PROT_GROWSDOWN : c_int = 0x01000000;
+            pub static PROT_GROWSUP : c_int = 0x02000000;
 
             pub static MAP_TYPE : c_int = 0x000f;
-            pub static MAP_ANONONYMOUS : c_int = 0x0020;
-            pub static MAP_32BIT : c_int = 0x0040;
-            pub static MAP_GROWSDOWN : c_int = 0x0100;
-            pub static MAP_DENYWRITE : c_int = 0x0800;
-            pub static MAP_EXECUTABLE : c_int = 0x01000;
-            pub static MAP_LOCKED : c_int = 0x02000;
-            pub static MAP_NONRESERVE : c_int = 0x04000;
-            pub static MAP_POPULATE : c_int = 0x08000;
-            pub static MAP_NONBLOCK : c_int = 0x010000;
-            pub static MAP_STACK : c_int = 0x020000;
+            pub static MAP_ANONONYMOUS : c_int = 0x0800;
+            pub static MAP_GROWSDOWN : c_int = 0x01000;
+            pub static MAP_DENYWRITE : c_int = 0x02000;
+            pub static MAP_EXECUTABLE : c_int = 0x04000;
+            pub static MAP_LOCKED : c_int = 0x08000;
+            pub static MAP_NONRESERVE : c_int = 0x0400;
+            pub static MAP_POPULATE : c_int = 0x010000;
+            pub static MAP_NONBLOCK : c_int = 0x020000;
+            pub static MAP_STACK : c_int = 0x040000;
         }
         #[cfg(target_os = "linux")]
         pub mod sysconf {
diff --git a/src/libstd/rt/libunwind.rs b/src/libstd/rt/libunwind.rs
index bdb049fbb5f..8c14e6c81e9 100644
--- a/src/libstd/rt/libunwind.rs
+++ b/src/libstd/rt/libunwind.rs
@@ -65,6 +65,9 @@ pub static unwinder_private_data_size: int = 2;
 #[cfg(target_arch = "arm")]
 pub static unwinder_private_data_size: int = 20;
 
+#[cfg(target_arch = "mips")]
+pub static unwinder_private_data_size: int = 2;
+
 pub struct _Unwind_Exception {
     exception_class: _Unwind_Exception_Class,
     exception_cleanup: _Unwind_Exception_Cleanup_Fn,
diff --git a/src/libstd/sync/atomics.rs b/src/libstd/sync/atomics.rs
index b4d465c0397..b38a5aed16f 100644
--- a/src/libstd/sync/atomics.rs
+++ b/src/libstd/sync/atomics.rs
@@ -225,6 +225,10 @@ impl AtomicInt {
     }
 }
 
+// temporary workaround
+// it causes link failure on MIPS target
+// libgcc doesn't implement 64-bit atomic operations for MIPS32
+#[cfg(not(target_arch = "mips"))]
 impl AtomicU64 {
     pub fn new(v: u64) -> AtomicU64 {
         AtomicU64 { v:v, nopod: marker::NoPod }
diff --git a/src/libstd/unstable/mutex.rs b/src/libstd/unstable/mutex.rs
index 34ddee46d35..2a3c8963980 100644
--- a/src/libstd/unstable/mutex.rs
+++ b/src/libstd/unstable/mutex.rs
@@ -324,12 +324,16 @@ mod imp {
         static __SIZEOF_PTHREAD_MUTEX_T: uint = 24 - 8;
         #[cfg(target_arch = "arm")]
         static __SIZEOF_PTHREAD_MUTEX_T: uint = 24 - 8;
+        #[cfg(target_arch = "mips")]
+        static __SIZEOF_PTHREAD_MUTEX_T: uint = 24 - 8;
         #[cfg(target_arch = "x86_64")]
         static __SIZEOF_PTHREAD_COND_T: uint = 48 - 8;
         #[cfg(target_arch = "x86")]
         static __SIZEOF_PTHREAD_COND_T: uint = 48 - 8;
         #[cfg(target_arch = "arm")]
         static __SIZEOF_PTHREAD_COND_T: uint = 48 - 8;
+        #[cfg(target_arch = "mips")]
+        static __SIZEOF_PTHREAD_COND_T: uint = 48 - 8;
 
         pub struct pthread_mutex_t {
             __align: libc::c_longlong,