1
0
Fork 0
mirror of https://github.com/anrieff/libcpuid synced 2024-12-26 16:55:45 +00:00

Fix build error on AArch64 when HWCAP_CPUID is not defined

Fix #205
This commit is contained in:
The Tumultuous Unicorn Of Darkness 2024-10-04 12:54:42 +02:00
parent bcd2dea9ee
commit 7770fffb6a
No known key found for this signature in database
GPG key ID: 1E55EE2EFF18BC1A

View file

@ -1296,13 +1296,15 @@ int cpuid_present(void)
#if defined(PLATFORM_X86) || defined(PLATFORM_X64)
return cpuid_exists_by_eflags();
#elif defined(PLATFORM_AARCH64)
# if defined(HAVE_GETAUXVAL) /* Linux */
# if defined(HAVE_GETAUXVAL) && defined(HWCAP_CPUID) /* Linux */
return (getauxval(AT_HWCAP) & HWCAP_CPUID);
# elif defined(HAVE_ELF_AUX_INFO) /* FreeBSD */
# elif defined(HAVE_ELF_AUX_INFO) && defined(HWCAP_CPUID) /* FreeBSD */
unsigned long hwcap = 0;
if (elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap)) == 0)
return ((hwcap & HWCAP_CPUID) != 0);
# endif /* HAVE_GETAUXVAL */
# elif !defined(HWCAP_CPUID)
# warning HWCAP_CPUID is not defined on this AArch64 system, cpuid_present() will always return 0
# endif /* HWCAP_CPUID */
/* On AArch64, return 0 by default */
return 0;
#else