On 4/22/25 07:54, Philippe Mathieu-Daudé wrote:
Add a helper to distinct the binary is targetting
Aarch64 or not.

Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org>
---
  include/qemu/target-info.h | 7 +++++++
  target-info.c              | 5 +++++
  2 files changed, 12 insertions(+)

diff --git a/include/qemu/target-info.h b/include/qemu/target-info.h
index 0224b35b166..395c009baf2 100644
--- a/include/qemu/target-info.h
+++ b/include/qemu/target-info.h
@@ -24,4 +24,11 @@ const char *target_name(void);
   */
  const char *target_machine_typename(void);
+/**
+ * target_aarch64:
+ *
+ * Returns whether the target architecture is Aarch64.
+ */
+bool target_aarch64(void);
+
  #endif
diff --git a/target-info.c b/target-info.c
index 0042769e3a2..7f1758ae34f 100644
--- a/target-info.c
+++ b/target-info.c
@@ -19,3 +19,8 @@ const char *target_machine_typename(void)
  {
      return target_info()->machine_typename;
  }
+
+bool target_aarch64(void)
+{
+    return target_info()->target_arch == SYS_EMU_TARGET_AARCH64;
+}

Reviewed-by: Pierrick Bouvier <pierrick.bouv...@linaro.org>

Reply via email to