about summary refs log tree commit diff
path: root/src/liballoc_system
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-12-23 09:09:26 +0000
committerbors <bors@rust-lang.org>2016-12-23 09:09:26 +0000
commit99913c5ead4d4f82ecda525b5d6f25dfaf541517 (patch)
tree7aed01c2e7d415dd69eb76fd862b1a4f1e392d63 /src/liballoc_system
parent82611a022468bb54476f149a0e77901ed48bcb9a (diff)
parent4dcb86767111149bcd233d6ac5c782d345d1e10b (diff)
downloadrust-99913c5ead4d4f82ecda525b5d6f25dfaf541517.tar.gz
rust-99913c5ead4d4f82ecda525b5d6f25dfaf541517.zip
Auto merge of #38401 - redox-os:redox_cross, r=brson
Redox Cross Compilation

I will admit - there are things here that I wish I did not have to do. This completes the ability to create a cross compiler from the rust repository for `x86_64-unknown-redox`. I will document this PR with inline comments explaining some things.

[View this gist to see how a cross compiler is built](https://gist.github.com/jackpot51/6680ad973986e84d69c79854249f2b7e)

Prior discussion of a smaller change is here: https://github.com/rust-lang/rust/pull/38366
Diffstat (limited to 'src/liballoc_system')
-rw-r--r--src/liballoc_system/lib.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/liballoc_system/lib.rs b/src/liballoc_system/lib.rs
index a4fabb5a2c9..4daa6cbb846 100644
--- a/src/liballoc_system/lib.rs
+++ b/src/liballoc_system/lib.rs
@@ -19,7 +19,7 @@
             issue = "27783")]
 #![feature(allocator)]
 #![feature(staged_api)]
-#![cfg_attr(unix, feature(libc))]
+#![cfg_attr(any(unix, target_os = "redox"), feature(libc))]
 
 // The minimum alignment guaranteed by the architecture. This value is used to
 // add fast paths for low alignment values. In practice, the alignment is a
@@ -71,7 +71,7 @@ pub extern "C" fn __rust_usable_size(size: usize, align: usize) -> usize {
     imp::usable_size(size, align)
 }
 
-#[cfg(unix)]
+#[cfg(any(unix, target_os = "redox"))]
 mod imp {
     extern crate libc;
 
@@ -87,7 +87,7 @@ mod imp {
         }
     }
 
-    #[cfg(target_os = "android")]
+    #[cfg(any(target_os = "android", target_os = "redox"))]
     unsafe fn aligned_malloc(size: usize, align: usize) -> *mut u8 {
         // On android we currently target API level 9 which unfortunately
         // doesn't have the `posix_memalign` API used below. Instead we use
@@ -109,7 +109,7 @@ mod imp {
         libc::memalign(align as libc::size_t, size as libc::size_t) as *mut u8
     }
 
-    #[cfg(not(target_os = "android"))]
+    #[cfg(not(any(target_os = "android", target_os = "redox")))]
     unsafe fn aligned_malloc(size: usize, align: usize) -> *mut u8 {
         let mut out = ptr::null_mut();
         let ret = libc::posix_memalign(&mut out, align as libc::size_t, size as libc::size_t);