Re: [PATCH v4 21/28] rust: alloc: remove `GlobalAlloc` and `krealloc_aligned`

From: Benno Lossin
Date: Wed Aug 07 2024 - 17:23:31 EST


On 05.08.24 17:19, Danilo Krummrich wrote:
> Now that we have all the `Allocator`s and the kernel `Box` and `Vec`
> implementations in place, remove `GlobalAlloc` and `krealloc_aligned`.

When I try to compile this patch, then I get this error:

UPD include/generated/utsversion.h
CC init/version-timestamp.o
KSYMS .tmp_vmlinux0.kallsyms.S
AS .tmp_vmlinux0.kallsyms.o
LD .tmp_vmlinux1
ld.lld: error: undefined symbol: __rust_realloc
>>> referenced by usercopy_64.c
>>> vmlinux.o:(alloc::raw_vec::finish_grow::<alloc::alloc::Global>)

ld.lld: error: undefined symbol: __rust_alloc
>>> referenced by usercopy_64.c
>>> vmlinux.o:(alloc::raw_vec::finish_grow::<alloc::alloc::Global>)
make[2]: *** [scripts/Makefile.vmlinux:34: vmlinux] Error 1

So maybe the `#[global_allocator]` needs to stay until we remove the
`alloc` dependency?

---
Cheers,
Benno

> Signed-off-by: Danilo Krummrich <dakr@xxxxxxxxxx>
> ---
> rust/kernel/alloc/allocator.rs | 63 ++--------------------------------
> 1 file changed, 2 insertions(+), 61 deletions(-)