[PATCH v2] support: add support_address_diff function
Yury Khrustalev
yury.khrustalev@arm.com
Fri Apr 10 10:26:55 GMT 2026
On Thu, Mar 26, 2026 at 01:50:49PM +0000, Yury Khrustalev wrote:
> Some malloc tests compare pointers meaning to compare addresses.
> On AArch64, the 64-bit value of the pointer may contain metadata
> along with the values of the address.
>
> In order to correctly compare addresses, we add new function for
> AArch64 target that will use the AArch64 64 SUBP (subtract pointer)
> instruction when it is available. This instruction uses the 56-bit
> addresses ignoring top-byte metadata.
>
> Best implementation is selected using ifunc resolver.
>
> On other targets and also on AArch64 when MTE is not available this
> function defaults to PTR_DIFF defined in libc-pointer-arith.h.
>
> Three malloc tests are modified accordingly:
> - tst-memalign-2.c
> - tst-memalign-3.c
> - tst-realloc.c
>
> ---
> base-commit: 4a97c12302
> passes regression on aarch64 and x86-64
>
> Changes in v2:
> - Use sysdeps files rather than arch-specific macro for conditional
> compilation of code.
> - Renamed the support_address_diff and added comment explaining what
> it does.
> - v1: https://inbox.sourceware.org/libc-alpha/20260325105900.828958-1-yury.khrustalev@arm.com/
>
Polite ping :)
More information about the Libc-alpha
mailing list