diff --git a/naive_ralloc/src/lib.rs b/naive_ralloc/src/lib.rs index 7285abe02..2cffaeda0 100644 --- a/naive_ralloc/src/lib.rs +++ b/naive_ralloc/src/lib.rs @@ -36,6 +36,16 @@ pub extern fn __rust_allocate(size: usize, _align: usize) -> *mut u8 { allocate(size) } +#[linkage = "external"] +#[no_mangle] +pub extern fn __rust_allocate_zeroed(size: usize, align: usize) -> *mut u8 { + unsafe { + let result = __rust_allocate(size, align); + intrinsics::write_bytes(result, 0, size); + result + } +} + #[linkage = "external"] #[no_mangle] pub extern fn __rust_deallocate(_ptr: *mut u8, _old_size: usize, _align: usize) {