[PATCH 2/2] malloc: aarch64: Add ifuncs for malloc functions

Yury Khrustalev yury.khrustalev@arm.com
Wed Jul 29 13:21:03 GMT 2026


On Tue, Jul 28, 2026 at 05:12:15PM +0100, Yury Khrustalev wrote:
> Introduce ifuncs and resolvers for functions pertinent to the
> malloc interface on the AArch64 target: malloc, calloc, free,
> realloc, memalign, valloc, pvalloc, posix_memalign, aligned_alloc,
> free_sized, free_aligned_sized, malloc_usable_size.
> 
> A target can define the USE_MULTIARCH_MALLOC macro. In this case
> it must provide alternative aliases for the malloc functions that
> point to the ifuncs.
> 
> This implementation respects the --disable-multi-arch configure
> flag. If multi-arch support is disabled, the generic aliases
> are used on aarch64.
> 
> This patch contains aarch64-specific resolvers. At this point they
> return core implementations but in the future they can be changed
> to support for features, e.g. to handle memory tagging.
> ---
>  malloc/malloc-internal.h                  |  1 +
>  malloc/malloc.c                           | 11 ++-
>  sysdeps/aarch64/multiarch/Makefile        |  6 ++
>  sysdeps/aarch64/multiarch/malloc-ifuncs.c | 82 +++++++++++++++++++++++
>  sysdeps/aarch64/multiarch/malloc-ifuncs.h | 25 +++++++
>  sysdeps/generic/malloc-ifuncs.h           | 36 ++++++++++
>  6 files changed, 159 insertions(+), 2 deletions(-)
>  create mode 100644 sysdeps/aarch64/multiarch/malloc-ifuncs.c
>  create mode 100644 sysdeps/aarch64/multiarch/malloc-ifuncs.h
>  create mode 100644 sysdeps/generic/malloc-ifuncs.h

To work around this bug in GDB [1], it is possible to apply this GDB
patch from Muhammad [2]. It cleanly applies to GDB master as of now and
provides a fix that resolves the issue with malloc being ifunc.

Although, [2] is not a final fix, it resolves the immediate problem and
is stable (passes regression). This might be useful after malloc ifuncs
are merged to Glibc master and before GDB is fixed.

[1]: https://sourceware.org/bugzilla/show_bug.cgi?id=34330
[2]: https://inbox.sourceware.org/gdb-patches/20260630110443.12900-1-muhammad.kamran@arm.com/

Thanks,
Yury



More information about the Libc-alpha mailing list