aboutsummaryrefslogtreecommitdiff
path: root/rust/kernel/allocator.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rust/kernel/allocator.rs')
-rw-r--r--rust/kernel/allocator.rs41
1 files changed, 2 insertions, 39 deletions
diff --git a/rust/kernel/allocator.rs b/rust/kernel/allocator.rs
index 280676993074..cfb406e2a710 100644
--- a/rust/kernel/allocator.rs
+++ b/rust/kernel/allocator.rs
@@ -26,43 +26,6 @@ unsafe impl GlobalAlloc for KernelAllocator {
#[global_allocator]
static ALLOCATOR: KernelAllocator = KernelAllocator;
-// `rustc` only generates these for some crate types. Even then, we would need
-// to extract the object file that has them from the archive. For the moment,
-// let's generate them ourselves instead.
-//
-// Note that `#[no_mangle]` implies exported too, nowadays.
-#[allow(clippy::no_mangle_with_rust_abi)]
+// See <https://github.com/rust-lang/rust/pull/86844>.
#[no_mangle]
-fn __rust_alloc(size: usize, _align: usize) -> *mut u8 {
- unsafe { bindings::krealloc(core::ptr::null(), size, bindings::GFP_KERNEL) as *mut u8 }
-}
-
-#[allow(clippy::no_mangle_with_rust_abi)]
-#[no_mangle]
-fn __rust_dealloc(ptr: *mut u8, _size: usize, _align: usize) {
- unsafe { bindings::kfree(ptr as *const core::ffi::c_void) };
-}
-
-#[allow(clippy::no_mangle_with_rust_abi)]
-#[no_mangle]
-fn __rust_realloc(ptr: *mut u8, _old_size: usize, _align: usize, new_size: usize) -> *mut u8 {
- unsafe {
- bindings::krealloc(
- ptr as *const core::ffi::c_void,
- new_size,
- bindings::GFP_KERNEL,
- ) as *mut u8
- }
-}
-
-#[allow(clippy::no_mangle_with_rust_abi)]
-#[no_mangle]
-fn __rust_alloc_zeroed(size: usize, _align: usize) -> *mut u8 {
- unsafe {
- bindings::krealloc(
- core::ptr::null(),
- size,
- bindings::GFP_KERNEL | bindings::__GFP_ZERO,
- ) as *mut u8
- }
-}
+static __rust_no_alloc_shim_is_unstable: u8 = 0;