Skip to content

Commit

Permalink
Use memalign instead of posix_memalign for Solaris
Browse files Browse the repository at this point in the history
As pointed out in rust-lang/libc@deb61c8,
Solaris 10 does not support posix_memalign.
Use memalign for all Solaris versions instead.
With this change applied I am able to cross-build rustc for Solaris 10.
  • Loading branch information
bgermann committed Sep 6, 2017
1 parent a209539 commit 5b76b86
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/liballoc_system/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ mod platform {
}
}

#[cfg(any(target_os = "android", target_os = "redox"))]
#[cfg(any(target_os = "android", target_os = "redox", target_os = "solaris"))]
#[inline]
unsafe fn aligned_malloc(layout: &Layout) -> *mut u8 {
// On android we currently target API level 9 which unfortunately
Expand All @@ -244,7 +244,7 @@ mod platform {
libc::memalign(layout.align(), layout.size()) as *mut u8
}

#[cfg(not(any(target_os = "android", target_os = "redox")))]
#[cfg(not(any(target_os = "android", target_os = "redox", target_os = "solaris")))]
#[inline]
unsafe fn aligned_malloc(layout: &Layout) -> *mut u8 {
let mut out = ptr::null_mut();
Expand Down

0 comments on commit 5b76b86

Please sign in to comment.