]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
arm64: CPU feature detection for Android
authorFoolbar <fooapr@outlook.com>
Sun, 9 Jun 2024 16:44:18 +0000 (00:44 +0800)
committerNiels Möller <nisse@lysator.liu.se>
Tue, 11 Jun 2024 18:01:59 +0000 (20:01 +0200)
getauxval() is available on Android since API 18.
https://developer.android.com/ndk/guides/cpu-features#features_using_libcs_getauxval3

fat-arm64.c

index 240302a6d1aec1bcd172754cb8434710c05abf92..45cce0ccf004f1be1b150ec8a993dcc194ce05af 100644 (file)
 #if defined(__linux__) && defined(__GLIBC__) && defined(__GLIBC_PREREQ)
 # if __GLIBC_PREREQ(2, 16)
 #  define USE_GETAUXVAL 1
-#  include <asm/hwcap.h>
-#  include <sys/auxv.h>
 # endif
+#elif __ANDROID_API__ >= 18
+# define USE_GETAUXVAL 1
+#endif
+
+#if USE_GETAUXVAL
+# include <asm/hwcap.h>
+# include <sys/auxv.h>
 #elif defined(__OpenBSD__)
 # include <sys/sysctl.h>
 # include <machine/cpu.h>