Skip to content

Commit 5b76b86

Browse files
committed
Use memalign instead of posix_memalign for Solaris
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.
1 parent a209539 commit 5b76b86

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/liballoc_system/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ mod platform {
221221
}
222222
}
223223

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

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

0 commit comments

Comments
 (0)