Provide out-of-line versions of some of the qemu/plugin.h API.
These will be referenced with --enable-plugin, but CONFIG_TCG
is disabled for a specific target.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
plugins/stubs.c | 49 +++++++++++++++++++++++++++++++++++++++++++++
plugins/meson.build | 5 ++++-
2 files changed, 53 insertions(+), 1 deletion(-)
create mode 100644 plugins/stubs.c
diff --git a/plugins/stubs.c b/plugins/stubs.c
new file mode 100644
index 0000000000..57af8357e4
--- /dev/null
+++ b/plugins/stubs.c
@@ -0,0 +1,49 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Stubs for when CONFIG_PLUGIN is enabled generally, but
+ * CONFIG_TCG_TARGET is disabled for a specific target.
+ * This will only be the case for 64-bit guests on 32-bit hosts
+ * when an alternate accelerator is enabled.
+ */
+
+#include "qemu/osdep.h"
+#include "qemu/plugin.h"
+#include "qapi/error.h"
+
+
+void qemu_plugin_add_opts(void)
+{
+}
+
+void qemu_plugin_opt_parse(const char *optstr, QemuPluginList *head)
+{
+ error_report("plugin interface not enabled in this build");
+ exit(1);
+}
+
+int qemu_plugin_load_list(QemuPluginList *head, Error **errp)
+{
+ return 0;
+}
+
+void qemu_plugin_vcpu_init_hook(CPUState *cpu)
+{
+}
+
+void qemu_plugin_vcpu_exit_hook(CPUState *cpu)
+{
+}
+
+void qemu_plugin_vcpu_idle_cb(CPUState *cpu)
+{
+}
+
+void qemu_plugin_vcpu_resume_cb(CPUState *cpu)
+{
+}
+
+CPUPluginState *qemu_plugin_create_vcpu_state(void)
+{
+ /* Protected by tcg_enabled() */
+ g_assert_not_reached();
+}
diff --git a/plugins/meson.build b/plugins/meson.build
index d60be2a4d6..42442fe22b 100644
--- a/plugins/meson.build
+++ b/plugins/meson.build
@@ -57,8 +57,11 @@ if host_os == 'windows'
command: dlltool_cmd
)
endif
-specific_ss.add(files(
+
+specific_ss.add(when: 'CONFIG_TCG', if_true: files(
'loader.c',
'core.c',
'api.c',
+), if_false: files(
+ 'stubs.c'
))
--
2.43.0