stubs: split monitor-core stubs into separate compilation units
The wild linker rejects duplicate symbols even from archive members. When qemu-storage-daemon links both libqmp (with monitor/monitor.c) and libqemuutil (with stubs/monitor-core.c), all symbols from the stub .o are pulled in, causing duplicates for monitor_cur, monitor_set_cur, and qapi_event_emit. Split each stub group into its own file so the linker only pulls in archive members whose symbols are actually needed. Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20260828-qemu-no-hmp-v5-46-9227de146347@redhat.com>
Marc-André Lureau committed
Aug 28, 2026 at 16:04 UTC
856b7f1768161ffd81e3d4f698c4a579288bb1e6
4 files changed
+24
-16
stubs/meson.build
+2
@@ -7,7 +7,9 @@ stub_ss.add(files('fdset.c'))
7
stub_ss.add(files('iothread-lock.c'))
8
stub_ss.add(files('is-daemonized.c'))
9
stub_ss.add(files('monitor-core.c'))
10
+stub_ss.add(files('monitor-cur.c'))
11
stub_ss.add(files('monitor-hmp.c'))
12
+stub_ss.add(files('qapi-event-emit.c'))
13
stub_ss.add(files('replay-mode.c'))
14
stub_ss.add(files('trace-control.c'))
15
stubs/monitor-core.c
-16
@@ -1,21 +1,5 @@
1
#include "qemu/osdep.h"
2
-#include "monitor/monitor.h"
2
#include "monitor/hmp.h"
4
-#include "qapi/qapi-emit-events.h"
5
-
6
-Monitor *monitor_cur(void)
7
-{
8
- return NULL;
9
-}
10
-
11
-Monitor *monitor_set_cur(Coroutine *co, Monitor *mon)
12
-{
13
- return NULL;
14
-}
15
-
16
-void qapi_event_emit(QAPIEvent event, QDict *qdict)
17
-{
18
-}
3
4
int monitor_hmp_vprintf(MonitorHMP *mon, const char *fmt, va_list ap)
5
{
stubs/monitor-cur.c
new
+14
@@ -0,0 +1,14 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
2
+
3
+#include "qemu/osdep.h"
4
+#include "monitor/monitor.h"
5
+
6
+Monitor *monitor_cur(void)
7
+{
8
+ return NULL;
9
+}
10
+
11
+Monitor *monitor_set_cur(Coroutine *co, Monitor *mon)
12
+{
13
+ return NULL;
14
+}
stubs/qapi-event-emit.c
new
+8
@@ -0,0 +1,8 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
2
+
3
+#include "qemu/osdep.h"
4
+#include "qapi/qapi-emit-events.h"
5
+
6
+void qapi_event_emit(QAPIEvent event, QDict *qdict)
7
+{
8
+}