On 5/12/25 5:54 PM, Pierrick Bouvier wrote:
On 5/12/25 11:33 AM, Daniel P. Berrangé wrote:
diff --git a/stubs/monitor-i386-rtc.c b/stubs/monitor-i386-rtc.c
new file mode 100644
index 0000000000..ee2e60d95b
--- /dev/null
+++ b/stubs/monitor-i386-rtc.c
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "qapi/qapi-commands-misc-i386.h"
+
+void qmp_rtc_reset_reinjection(Error **errp)
+{
+    /* Nothing to do since non-x86 machines lack an RTC */
+}

I think I'd create one stub file per qapi/<foo>-<target>.json.

That's what I started doing but I forgot that doesn't work out well
with the linker.

The linker's granularity for dropping stubs is per-file, not per-symbol.

If /any/ method in a stub/nnn.c file is needed, the linker will pull in
all methods. This results in duplicate symbol errors if only a subset
of stub methods were actually needed.


Richard mentioned this behaviour as well, but I could not see where it
is implemented in our build system.

The only thing possibly related is the undefsyms mechanic, but from what
I understand, it's only for ensuring modules can be linked.


Answer: it's an implicit behaviour, due to the fact libqemuutil is built as a (real) static library, so the linker only adds code as needed.

This forces us to have a separate stub file per build configuration
scenario that can affect use of stubs.

With regards,
Daniel



Reply via email to