[PATCH v2 0/2] malloc: introduce ifuncs for malloc functions

Yury Khrustalev yury.khrustalev@arm.com
Mon Apr 20 14:14:57 GMT 2026


See commit message for details. In a nutshell, we want to add ifuncs
for the functions related to the malloc API (on targets that support
ifuncs). This will allow to add alternative (e.g. target-specific)
implementations for these functions.

The following aspects have been considered:

1) Generic resolvers that return core implementations. These will be
   used for most targets that don't provide their custome resolvers.

2) Allow targets to provide their own resolvers (e.g. aarch64 may use
   this to implement resolvers that return memory tagging implementations
   when this is supported and requested).

3) For the targets without ifunc support there is no functional change.

Passes regression on aarch64 and x86-64 and has been build-tested using
the build-many-glibcs script for various targets including those without
ifunc support. OK for trunk?

Changes in v2:
 - Fixed ifunc resolvers arguments: use no arguments for generic resolvers
   and use 'uint64_t arg0, uint64_t arg1[]' for aarch64 resolvers.
 - Added grep test to check that code in malloc.c doesn't use non-_core
   functions.
 - Cleaned-up makefile patch.

---
base-commit: 575ae6063d

---
Yury Khrustalev (2):
  misc: fix lint-makefiles failures
  malloc: introduce ifuncs for malloc functions

 malloc/Makefile                    |   6 ++
 malloc/malloc.c                    | 117 +++++++++++++++++------------
 malloc/tst-check-internal-calls.sh |  53 +++++++++++++
 sysdeps/aarch64/Makefile           |  42 ++++++++---
 sysdeps/aarch64/malloc-ifuncs.c    |  85 +++++++++++++++++++++
 sysdeps/generic/Makefile           |  30 ++++++--
 sysdeps/generic/malloc-ifuncs.c    |  94 +++++++++++++++++++++++
 sysdeps/generic/malloc-ifuncs.h    |  61 +++++++++++++++
 8 files changed, 423 insertions(+), 65 deletions(-)
 create mode 100644 malloc/tst-check-internal-calls.sh
 create mode 100644 sysdeps/aarch64/malloc-ifuncs.c
 create mode 100644 sysdeps/generic/malloc-ifuncs.c
 create mode 100644 sysdeps/generic/malloc-ifuncs.h

-- 
2.47.3



More information about the Libc-alpha mailing list