[compiler-rt] [compiler-rt][AArch64][Android] Use getauxval on Android. (PR #102979)

Saleem Abdulrasool via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 13 07:50:02 PDT 2024


================
@@ -20,11 +21,15 @@ _Bool __aarch64_has_sme_and_tpidr2_el0;
 #define HWCAP2_SME (1 << 23)
 #endif
 
+#ifdef __ANDROID__
+extern unsigned long int getauxval(unsigned long int);
+#define GETAUXVAL(x) getauxval(x)
+#else
 extern unsigned long int __getauxval (unsigned long int);
+#define GETAUXVAL(x) __getauxval(x)
+#endif
 
-static _Bool has_sme(void) {
-  return __getauxval(AT_HWCAP2) & HWCAP2_SME;
-}
+static _Bool has_sme(void) { return GETAUXVAL(AT_HWCAP2) & HWCAP2_SME; }
----------------
compnerd wrote:

It avoids the macros and allows us to have a single platform agnostic implementation. Over time, we would drop the use of the underscore variant of the function.

https://github.com/llvm/llvm-project/pull/102979


More information about the llvm-commits mailing list