Call TargetInfo::target_aarch64() at runtime, allowing to remove the target-specific TARGET_AARCH64 definition and build cpu-max.c once as common object.
Signed-off-by: Philippe Mathieu-Daudé <[email protected]> --- target/arm/cpu-max.c | 8 ++------ target/arm/meson.build | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/target/arm/cpu-max.c b/target/arm/cpu-max.c index 8cf8edc6535..d38bdfcf811 100644 --- a/target/arm/cpu-max.c +++ b/target/arm/cpu-max.c @@ -8,6 +8,7 @@ #include "qemu/osdep.h" #include "qemu/units.h" +#include "qemu/target-info.h" #include "system/hw_accel.h" #include "system/kvm.h" #include "system/qtest.h" @@ -190,12 +191,7 @@ void aa32_max_features(ARMCPU *cpu) static void cpu_max_initfn(Object *obj) { ARMCPU *cpu = ARM_CPU(obj); - -#ifdef TARGET_AARCH64 - const bool aarch64_enabled = true; -#else - const bool aarch64_enabled = false; -#endif /* !TARGET_AARCH64 */ + const bool aarch64_enabled = target_aarch64(); if (hwaccel_enabled()) { assert(aarch64_enabled); diff --git a/target/arm/meson.build b/target/arm/meson.build index 3e02941d0d5..9408131d178 100644 --- a/target/arm/meson.build +++ b/target/arm/meson.build @@ -9,7 +9,6 @@ arm_user_ss = ss.source_set() arm_common_system_ss.add(files('gdbstub.c')) arm_user_ss.add(files('gdbstub.c')) -arm_ss.add(files('cpu-max.c')) arm_ss.add(when: 'TARGET_AARCH64', if_true: files( 'cpu64.c', )) @@ -20,6 +19,7 @@ arm_common_ss.add(files( arm_common_user_system_ss.add(files( 'cpregs-gcs.c', 'cpregs-pmu.c', + 'cpu-max.c', 'debug_helper.c', 'helper.c', 'vfp_fpscr.c', -- 2.53.0
