From: Andrea Bolognani Date: Fri, 5 Feb 2021 13:07:27 +0000 (+0100) Subject: cpu: Fix build on some aarch64 platforms X-Git-Tag: v7.1.0-rc1~226 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f834c341fbec94ead3671931c58db9c0488b76db;p=thirdparty%2Flibvirt.git cpu: Fix build on some aarch64 platforms 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 Reviewed-by: Pavel Hrdina --- 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,