[PATCH] support: add __address_diff function

Florian Weimer fweimer@redhat.com
Wed Mar 25 11:52:13 GMT 2026


* Yury Khrustalev:

> diff --git a/support/pointer-arith.h b/support/pointer-arith.h
> new file mode 100644
> index 0000000000..fc9cf593ac
> --- /dev/null
> +++ b/support/pointer-arith.h
> @@ -0,0 +1,31 @@

> +#ifndef _POINTER_ARITH_H
> +#define _POINTER_ARITH_H 1
> +
> +#include <stddef.h>
> +#include <libc-pointer-arith.h>
> +
> +#ifdef __ARM_ARCH_ISA_A64
> +ptrdiff_t __address_diff (const void *lhs, const void *rhs);
> +#else
> +#define __address_diff PTR_DIFF
> +#endif /* __ARM_ARCH_ISA_A64 */
> +
> +#endif

Given that it's in support/, it should probably be called
support_address_diff or something.  We don't use __ mangling under
support/.

The #ifdef is not necessary, sysdeps overrides should work for support/
headers.  The comment should say that the difference is computed in
bytes, not elements.

Thanks,
Florian



More information about the Libc-alpha mailing list