summaryrefslogtreecommitdiff
path: root/libatomic
diff options
context:
space:
mode:
authorYury Khrustalev <yury.khrustalev@arm.com>2025-06-05 15:40:05 +0100
committerYury Khrustalev <yury.khrustalev@arm.com>2025-07-31 12:39:10 +0100
commita8461846adbc0e9887579ec5898be36ef01282ba (patch)
tree7ba36495437c46c12b7d93da43c7a2145a14f40d /libatomic
parent647bd0a02789f17ab6e092fff60839d28fd635dc (diff)
aarch64: Stop using sys/ifunc.h header in libatomic and libgcc
This optional header is used to bring in the definition of the struct __ifunc_arg_t type. Since it has been added to glibc only recently, the previous implementation had to check whether this header is present and, if not, it provide its own definition. This creates dead code because either one of these two parts would not be tested. The ABI specification for ifunc resolvers allows to create own ABI-compatible definition for this type, which is the right way of doing it. In addition to improving consistency, the new approach also helps with addition of new fields to struct __ifunc_arg_t type without the need to work-around situations when the definition imported from the header lacks these new fields. ABI allows to define as many hwcap fields in this struct as needed, provided that at runtime we only access the fields that are permitted by the _size value. gcc/ * config/aarch64/aarch64.cc (build_ifunc_arg_type): Add new fields _hwcap3 and _hwcap4. libatomic/ * config/linux/aarch64/host-config.h (__ifunc_arg_t): Remove sys/ifunc.h and add new fields _hwcap3 and _hwcap4. libgcc/ * config/aarch64/cpuinfo.c (__ifunc_arg_t): Likewise. (__init_cpu_features): obtain and assign values for the fields _hwcap3 and _hwcap4. (__init_cpu_features_constructor): check _size in the arg argument.
Diffstat (limited to 'libatomic')
-rw-r--r--libatomic/config/linux/aarch64/host-config.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/libatomic/config/linux/aarch64/host-config.h b/libatomic/config/linux/aarch64/host-config.h
index d0d44bf18ea..c6f8d693f2c 100644
--- a/libatomic/config/linux/aarch64/host-config.h
+++ b/libatomic/config/linux/aarch64/host-config.h
@@ -40,16 +40,20 @@
# define HWCAP2_LSE128 (1UL << 47)
#endif
-#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;
+
# define _IFUNC_ARG_HWCAP (1ULL << 62)
-#endif
/* From the file which imported `host-config.h' we can ascertain which
architectural extension provides relevant atomic support. From this,