diff --git a/src/stdlib/src/lib.rs b/src/stdlib/src/lib.rs index 8f88d9d92e..17788dbdfa 100644 --- a/src/stdlib/src/lib.rs +++ b/src/stdlib/src/lib.rs @@ -71,6 +71,15 @@ pub extern "C" fn abs(i: c_int) -> c_int { } } +#[no_mangle] +pub unsafe extern "C" fn aligned_alloc(alignment: size_t, size: size_t) -> *mut c_void { + if size % alignment != 0 { + return ptr::null_mut(); + } + + memalign(alignment, size) +} + #[no_mangle] pub unsafe extern "C" fn atexit(func: Option) -> c_int { for i in 0..ATEXIT_FUNCS.len() {