mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-05 12:35:20 +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;
|
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 */
|
/* Generate human readable flag list according to the order of */
|
||||||
/* AT_HWCAP bit map */
|
/* AT_HWCAP bit map */
|
||||||
const char *aarch64_cpu_flags[MAX_CPU_FLAGS] = {
|
const char *aarch64_cpu_flags[MAX_CPU_FLAGS] = {
|
||||||
@ -560,8 +560,6 @@ virCPUarmCpuDataFromRegs(virCPUarmData *data)
|
|||||||
hwcaps = getauxval(AT_HWCAP);
|
hwcaps = getauxval(AT_HWCAP);
|
||||||
# elif defined(WITH_ELF_AUX_INFO)
|
# elif defined(WITH_ELF_AUX_INFO)
|
||||||
elf_aux_info(AT_HWCAP, &hwcaps, sizeof(u_long));
|
elf_aux_info(AT_HWCAP, &hwcaps, sizeof(u_long));
|
||||||
# else
|
|
||||||
# error No routines to retrieve a value from the auxiliary vector
|
|
||||||
# endif
|
# endif
|
||||||
VIR_DEBUG("CPU flags read from register: 0x%016lx", hwcaps);
|
VIR_DEBUG("CPU flags read from register: 0x%016lx", hwcaps);
|
||||||
|
|
||||||
@ -674,7 +672,7 @@ struct cpuArchDriver cpuDriverArm = {
|
|||||||
.arch = archs,
|
.arch = archs,
|
||||||
.narch = G_N_ELEMENTS(archs),
|
.narch = G_N_ELEMENTS(archs),
|
||||||
.compare = virCPUarmCompare,
|
.compare = virCPUarmCompare,
|
||||||
#if defined(__aarch64__)
|
#if defined(__aarch64__) && (defined(WITH_GETAUXVAL) || defined(WITH_ELF_AUX_INFO))
|
||||||
.getHost = virCPUarmGetHost,
|
.getHost = virCPUarmGetHost,
|
||||||
#endif
|
#endif
|
||||||
.decode = NULL,
|
.decode = NULL,
|
||||||
|
Loading…
Reference in New Issue
Block a user