Commit ee693c9a1d for qemu.org
commit ee693c9a1dc809ad13dfdfa3d583c67869816a54
Author: Philippe Mathieu-Daudé <philmd@mailo.com>
Date: Fri May 15 12:06:04 2026 +0200
target/arm: Build cpu-max.c once
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é <philmd@linaro.org>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20260526203722.79463-18-philmd@linaro.org>
diff --git a/target/arm/cpu-max.c b/target/arm/cpu-max.c
index 8cf8edc653..d38bdfcf81 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 3e02941d0d..9408131d17 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',