Skip to content

Instantly share code, notes, and snippets.

@m-bers
Last active January 12, 2021 15:20
Show Gist options
  • Save m-bers/656d736686ebc240d76407ebdd4221f6 to your computer and use it in GitHub Desktop.
Save m-bers/656d736686ebc240d76407ebdd4221f6 to your computer and use it in GitHub Desktop.
diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c
index 6ba5bf0..a5d3573 100644
--- a/src/cpu/cpu_arm.c
+++ b/src/cpu/cpu_arm.c
@@ -21,7 +21,7 @@
*/
#include <config.h>
-#if defined(__aarch64__)
+#if defined(__aarch64__) && (defined(WITH_GETAUXVAL) || defined(WITH_ELF_AUX_INFO))
# if defined(WITH_ASM_HWCAP_H)
# include <asm/hwcap.h>
# endif
@@ -555,12 +555,13 @@ virCPUarmCpuDataFromRegs(virCPUarmData *data)
size_t i;
# if defined(WITH_GETAUXVAL)
- if (!(getauxval(AT_HWCAP) & HWCAP_CPUID)) {
+ if (!(getauxval(AT_HWCAP) & HWCAP_CPUID))
+ # endif
+ {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("CPUID registers unavailable"));
return -1;
}
-# endif
/* read the cpuid data from MIDR_EL1 register */
asm("mrs %0, MIDR_EL1" : "=r" (cpuid));
@@ -576,7 +577,7 @@ virCPUarmCpuDataFromRegs(virCPUarmData *data)
# elif defined(WITH_ELF_AUX_INFO)
elf_aux_info(AT_HWCAP, &hwcaps, sizeof(u_long));
# else
-# error No routines to retrieve a value from the auxiliary vector
+hwcaps = 0;
# endif
VIR_DEBUG("CPU flags read from register: 0x%016lx", hwcaps);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment