[compiler-rt][builtins] Define AT_HWCAP2 for AArch64
authorXi Ruoyao <xry111@xry111.site>
Wed, 8 Mar 2023 15:26:57 +0000 (16:26 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 8 Mar 2023 15:26:57 +0000 (16:26 +0100)
Without the definition, build fails on AArch64 with

> error: 'AT_HWCAP2' undeclared (first use in this function);
> did you mean 'AT_HWCAP'?

with old Glibc versions.

Differential Revision: https://reviews.llvm.org/D145494

compiler-rt/lib/builtins/cpu_model.c

index 4e3ce7a..01bab46 100644 (file)
@@ -924,6 +924,9 @@ int CONSTRUCTOR_ATTRIBUTE __cpu_indicator_init(void) {
 #define HWCAP_SB (1 << 29)
 #endif
 
+#ifndef AT_HWCAP2
+#define AT_HWCAP2 26
+#endif
 #ifndef HWCAP2_DCPODP
 #define HWCAP2_DCPODP (1 << 0)
 #endif