Declare target_combined_binary() in target-info.h and provide a stub
implementation in stubs/target-info.c that returns false.

This lets target-independent tools and single-target binaries use the
query without a combined qemu-system implementation. A combined binary
can provide its own implementation returning true.

Signed-off-by: Yonggang Luo <[email protected]>
---
 MAINTAINERS                |  1 +
 include/qemu/target-info.h |  7 +++++++
 stubs/meson.build          |  1 +
 stubs/target-info.c        | 10 ++++++++++
 4 files changed, 19 insertions(+)
 create mode 100644 stubs/target-info.c

diff --git a/MAINTAINERS b/MAINTAINERS
index fc60193aa3f..669814d29c5 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2146,6 +2146,7 @@ TargetInfo API
 M: Pierrick Bouvier <[email protected]>
 M: Philippe Mathieu-Daudé <[email protected]>
 S: Supported
+F: stubs/target-info.c
 F: include/qemu/target-info*.h
 F: target-info*.c
 F: tests/unit/test-multi-targets.c
diff --git a/include/qemu/target-info.h b/include/qemu/target-info.h
index adda363ac39..9704ee32605 100644
--- a/include/qemu/target-info.h
+++ b/include/qemu/target-info.h
@@ -42,6 +42,13 @@ const char *target_cpu_type(void);
  */
 bool target_big_endian(void);
 
+/**
+ * target_combined_binary:
+ *
+ * Returns: %true if this is the combined qemu-system binary.
+ */
+bool target_combined_binary(void);
+
 /**
  * target_base_arm:
  *
diff --git a/stubs/meson.build b/stubs/meson.build
index 29b6644b254..ed7aeb61d0d 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -3,6 +3,7 @@
 # below, so that it is clear who needs the stubbed functionality.
 
 stub_ss.add(files('cpu-get-clock.c'))
+stub_ss.add(files('target-info.c'))
 stub_ss.add(files('fdset.c'))
 stub_ss.add(files('iothread-lock.c'))
 stub_ss.add(files('is-daemonized.c'))
diff --git a/stubs/target-info.c b/stubs/target-info.c
new file mode 100644
index 00000000000..8873aa21594
--- /dev/null
+++ b/stubs/target-info.c
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "qemu/osdep.h"
+
+#include "qemu/target-info.h"
+
+bool target_combined_binary(void)
+{
+    return false;
+}
-- 
2.55.0.windows.3


Reply via email to