qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Pierrick Bouvier <pierrick.bouvier@linaro.org>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>, qemu-devel@nongnu.org
Cc: alex.bennee@linaro.org, stefanha@redhat.com,
	peter.maydell@linaro.org, Markus Armbruster <armbru@redhat.com>,
	richard.henderson@linaro.org, pbonzini@redhat.com,
	jsnow@redhat.com, berrange@redhat.com, thuth@redhat.com,
	Michael Roth <michael.roth@amd.com>
Subject: Re: [PATCH 10/13] qapi: add weak stubs for target specific commands
Date: Thu, 8 May 2025 13:33:16 -0700	[thread overview]
Message-ID: <8993e11b-d9c4-42a7-b24e-6626900b836d@linaro.org> (raw)
In-Reply-To: <30076d35-3452-4061-8fc6-d3eb9810d0b8@linaro.org>

On 5/7/25 11:57 PM, Philippe Mathieu-Daudé wrote:
> On 8/5/25 01:14, Pierrick Bouvier wrote:
>> We are about to expose various target specific commands for all targets,
>> so we need to stub not implemented qmp_* functions.
>>
>> MinGW does not support weak symbols without at least one strong
>> definition, so we'll have to detail stubs per target. Sad.
>>
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> ---
>>    qapi/commands-weak-stubs.c | 38 ++++++++++++++++++++++++++++++++++++++
>>    qapi/meson.build           |  2 ++
>>    2 files changed, 40 insertions(+)
>>    create mode 100644 qapi/commands-weak-stubs.c
>>
>> diff --git a/qapi/commands-weak-stubs.c b/qapi/commands-weak-stubs.c
>> new file mode 100644
>> index 00000000000..9734263c32e
>> --- /dev/null
>> +++ b/qapi/commands-weak-stubs.c
>> @@ -0,0 +1,38 @@
>> +/*
>> + * Weak symbols for target specific commands
>> + *
>> + * Copyright Linaro, 2025
>> + *
>> + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
>> + * See the COPYING.LIB file in the top-level directory.
>> + *
>> + */
>> +
>> +#include "qemu/osdep.h"
>> +#include <glib.h>
>> +
>> +#define NOT_REACHABLE(symbol)                                                  \
>> +void __attribute__((weak)) symbol(void);                                       \
>> +void __attribute__((weak)) symbol(void) { g_assert_not_reached(); }
>> +
>> +#define WEAK_STUB(command)                                                     \
>> +NOT_REACHABLE(qmp_marshal_##command)                                           \
>> +NOT_REACHABLE(qmp_##command)
>> +
>> +WEAK_STUB(query_cpu_model_comparison);
>> +WEAK_STUB(query_cpu_model_baseline);
>> +WEAK_STUB(set_cpu_topology);
>> +WEAK_STUB(query_s390x_cpu_polarization);
>> +WEAK_STUB(rtc_reset_reinjection);
>> +WEAK_STUB(query_sev);
>> +WEAK_STUB(query_sev_launch_measure);
>> +WEAK_STUB(query_sev_capabilities);
>> +WEAK_STUB(sev_inject_launch_secret);
>> +WEAK_STUB(query_sev_attestation_report);
>> +WEAK_STUB(query_sgx);
>> +WEAK_STUB(query_sgx_capabilities);
>> +WEAK_STUB(xen_event_list);
>> +WEAK_STUB(xen_event_inject);
>> +WEAK_STUB(query_cpu_model_expansion);
>> +WEAK_STUB(query_cpu_definitions);
>> +WEAK_STUB(query_gic_capabilities);
> 
> Shouldn't this also be generated by QAPI scripts?
> 

It's a bit tricky, because we would need to generate the build system 
also (which targets links what), and meson is a sane tool so it prevents 
users from doing that.

>> diff --git a/qapi/meson.build b/qapi/meson.build
>> index eadde4db307..60fc958ec10 100644
>> --- a/qapi/meson.build
>> +++ b/qapi/meson.build
>> @@ -147,3 +147,5 @@ foreach output : qapi_specific_outputs + qapi_nonmodule_outputs
>>      specific_ss.add(when: 'CONFIG_SYSTEM_ONLY', if_true: qapi_files[i])
>>      i = i + 1
>>    endforeach
>> +
>> +system_ss.add(files('commands-weak-stubs.c'))
> 



  reply	other threads:[~2025-05-08 20:33 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-07 23:14 [PATCH 00/13] single-binary: make QAPI generated files common Pierrick Bouvier
2025-05-07 23:14 ` [PATCH 01/13] qapi: introduce 'runtime_if' for QAPI json Pierrick Bouvier
2025-05-08  6:53   ` Philippe Mathieu-Daudé
2025-05-08 20:22     ` Pierrick Bouvier
2025-05-15  4:39   ` Markus Armbruster
2025-05-15 15:42     ` Pierrick Bouvier
2025-05-07 23:14 ` [PATCH 02/13] qapi/introspect: generate schema as a QObject directly Pierrick Bouvier
2025-05-07 23:14 ` [PATCH 03/13] qobject/qlit: allow to hide dict or list entries Pierrick Bouvier
2025-05-08 14:21   ` Daniel P. Berrangé
2025-05-08 20:25     ` Pierrick Bouvier
2025-05-07 23:14 ` [PATCH 04/13] qapi/introspect: hide fields in schema Pierrick Bouvier
2025-05-07 23:14 ` [PATCH 05/13] qapi/commands: register commands conditionally Pierrick Bouvier
2025-05-07 23:14 ` [PATCH 06/13] qapi/visit: hide fields in JSON marshalling Pierrick Bouvier
2025-05-07 23:14 ` [PATCH 07/13] qapi: add access to qemu/target-info.h Pierrick Bouvier
2025-05-08  6:57   ` Philippe Mathieu-Daudé
2025-05-07 23:14 ` [PATCH 08/13] qemu/target-info: implement missing helpers Pierrick Bouvier
2025-05-08  6:40   ` Philippe Mathieu-Daudé
2025-05-08 20:30     ` Pierrick Bouvier
2025-05-07 23:14 ` [PATCH 09/13] qapi: transform target specific 'if' in runtime checks Pierrick Bouvier
2025-05-08  6:44   ` Philippe Mathieu-Daudé
2025-05-08 14:40   ` Daniel P. Berrangé
2025-05-08 20:48     ` Pierrick Bouvier
2025-05-10  6:57     ` Markus Armbruster
2025-05-13  0:36       ` Pierrick Bouvier
2025-05-13  7:08         ` Markus Armbruster
2025-05-13 22:52           ` Pierrick Bouvier
2025-05-14  7:13             ` Markus Armbruster
2025-05-14 16:54               ` Pierrick Bouvier
2025-05-14 14:09   ` Markus Armbruster
2025-05-14 16:50     ` Pierrick Bouvier
2025-05-07 23:14 ` [PATCH 10/13] qapi: add weak stubs for target specific commands Pierrick Bouvier
2025-05-08  6:57   ` Philippe Mathieu-Daudé
2025-05-08 20:33     ` Pierrick Bouvier [this message]
2025-05-07 23:14 ` [PATCH 11/13] qapi: make all generated files common Pierrick Bouvier
2025-05-08  6:57   ` Philippe Mathieu-Daudé
2025-05-07 23:14 ` [PATCH 13/13] [ANNEX] build/qapi: after series Pierrick Bouvier
2025-05-07 23:33 ` [PATCH 00/13] single-binary: make QAPI generated files common Pierrick Bouvier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8993e11b-d9c4-42a7-b24e-6626900b836d@linaro.org \
    --to=pierrick.bouvier@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=michael.roth@amd.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=stefanha@redhat.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).