Hi Remi

On Wed, Jul 23, 2025 at 01:53:13PM +0000, Remi Machet wrote:
> 
> On 7/23/25 04:45, Yury Khrustalev wrote:
> 
> ...
>
> -#if __has_include(<sys/ifunc.h>)
> -#include <sys/ifunc.h>
> -#else
> +/* The following struct is ABI-correct description of the 2nd argument for an
> +   ifunc resolver as per SYSVABI spec (see link below).  It is safe to extend
> +   it with new fields.  The ifunc resolver implementations must always check
> +   the runtime size of the buffer using the value in the _size field.
> +   https://github.com/ARM-software/abi-aa/blob/main/sysvabi64/sysvabi64.rst. 
>  */
>  typedef struct __ifunc_arg_t {
>    unsigned long _size;
>    unsigned long _hwcap;
>    unsigned long _hwcap2;
> +  unsigned long _hwcap3;
> +  unsigned long _hwcap4;
>  } __ifunc_arg_t;
> 
> Hi Yury,
> 
> Having __ifunc_arg_t defined in 2 places (libatomic's host-config.h and 
> libgcc cpuinfo.c) feels like a maintenance nightmare to me, would it be 
> feasible to somehow combine the 2 definitions into one?

This is a good point. In fact this struct is used in 3 places (also in gcc in 
build_ifunc_arg_type()).

However, libatomic is supposed to be independent in terms of build process: it 
should be possible
to build libatomic without gcc. If we shared some header from libgcc, we'd have 
to create a new
dependency between libgcc and libatomic. I'd rather not do it.

In essence, this type (either as a struct or a plain array of uint64_t's)  
should be defined locally
where it is used. It just needs to comply with the ABI spec.

That said, if you see a better way for having the definition shared across all 
the components,
I'd be interested to know about it.

Kind regards,
Yury

Reply via email to