mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
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 <abologna@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
03af15c024
commit
f834c341fb
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user