[PATCH v3] aarch64: add support for hwcap3,4
Yury Khrustalev
Yury.Khrustalev@arm.com
Wed Apr 23 08:23:10 GMT 2025
Hi,
> From: enh <enh@google.com>
> Sent: 22 April 2025 04:58 PM
> To: Yury Khrustalev
> Cc: libc-alpha@sourceware.org; fweimer@redhat.com; adhemerval.zanella@linaro.org
> Subject: Re: [PATCH v3] aarch64: add support for hwcap3,4
>
> On Tue, Apr 22, 2025 at 11:52 AM enh <enh@google.com> wrote:
> ...
> having updated some ifunc resolvers to see what this looks like, i
> find the "off by one" in the array versus the constants quite
> off-putting.
>
> adding
> ```
> #define _hwcap3 _hwcap_array[2]
> ```
> etc seems quite tempting for better readability at the call sites.
To be honest, I would just do that:
struct __ifunc_arg_t
{
unsigned long _size;
unsigned long _hwcap_array[_IFUNC_HWCAP_MAX];
};
And define these macros for the sake of existing code to compiler without errors:
#define _hwcap _hwcap_array[0]
#define _hwcap2 _hwcap_array[1]
No problem from union and allows to write a helper function to access HWCAP value
by its number (suggested by Chris Bazley <chris.bazley@arm.com>):
static inline long int
__ifunc_arg_get_hwcap(const struct __ifunc_arg_t *arg, size_t n)
{
/* Return 0 if n corresponds to beyond the runtime size in
"arg->_size" and return "_hwcap_array[n]" otherwise. */
}
The only problem is that _hwcap and _hwcap2 are likely to be used as identifiers
elsewhere in existing code that includes sys/ifunc.h. I'm not sure if it's a big
issue.
Kind regards,
Yury
More information about the Libc-alpha
mailing list