[libvirt PATCH 3/3] cpu: Fix build on some aarch64 platforms

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On platforms that lack both getauxval() and elf_aux_info(),
such as OpenBSD and macOS, host CPU detection can't work.

https://gitlab.com/libvirt/libvirt/-/issues/121

Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
---
 src/cpu/cpu_arm.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c
index 71702dbc91..6da84535ba 100644
--- a/src/cpu/cpu_arm.c
+++ b/src/cpu/cpu_arm.c
@@ -529,7 +529,7 @@ virCPUarmValidateFeatures(virCPUDefPtr cpu)
     return 0;
 }
 
-#if defined(__aarch64__)
+#if defined(__aarch64__) && (defined(WITH_GETAUXVAL) || defined(WITH_ELF_AUX_INFO))
 /* Generate human readable flag list according to the order of */
 /* AT_HWCAP bit map */
 const char *aarch64_cpu_flags[MAX_CPU_FLAGS] = {
@@ -560,8 +560,6 @@ virCPUarmCpuDataFromRegs(virCPUarmData *data)
     hwcaps = getauxval(AT_HWCAP);
 # 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
 # endif
     VIR_DEBUG("CPU flags read from register:  0x%016lx", hwcaps);
 
@@ -674,7 +672,7 @@ struct cpuArchDriver cpuDriverArm = {
     .arch = archs,
     .narch = G_N_ELEMENTS(archs),
     .compare = virCPUarmCompare,
-#if defined(__aarch64__)
+#if defined(__aarch64__) && (defined(WITH_GETAUXVAL) || defined(WITH_ELF_AUX_INFO))
     .getHost = virCPUarmGetHost,
 #endif
     .decode = NULL,
-- 
2.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux