[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC 2/4] tcg/plugins: Automatically define CURRENT_PLUGIN
From: |
Alex Bennée |
Subject: |
Re: [RFC 2/4] tcg/plugins: Automatically define CURRENT_PLUGIN |
Date: |
Wed, 21 Sep 2022 15:00:18 +0100 |
User-agent: |
mu4e 1.9.0; emacs 28.2.50 |
Andrew Fasano <fasano@mit.edu> writes:
> Use plugin filenames to set the preprocessor variable CURRENT_PLUGIN
> as a string during plugin compilation.
>
> Signed-off-by: Andrew Fasano <fasano@mit.edu>
> ---
> contrib/plugins/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/contrib/plugins/Makefile b/contrib/plugins/Makefile
> index df3499f4f2..b7720fea0f 100644
> --- a/contrib/plugins/Makefile
> +++ b/contrib/plugins/Makefile
> @@ -34,7 +34,7 @@ CFLAGS += -I$(SRC_PATH)/include/qemu
> all: $(SONAMES)
>
> %.o: %.c
> - $(CC) $(CFLAGS) -c -o $@ $<
> + $(CC) $(CFLAGS) -DCURRENT_PLUGIN=\"$(basename $@)\" -c -o $@ $<
While all plugins are currently single files this seems a little clumsy.
We can already check exported plugin symbols in loader.c (see
qemu_plugin_version) so maybe it would be better to declare an API
update and mandate any plugin object also needs to define a
qemu_plugin_name with a null terminated string?
>
> lib%.so: %.o
> $(CC) -shared -Wl,-soname,$@ -o $@ $^ $(LDLIBS)
--
Alex Bennée
- [RFC 0/4] Support interactions between TCG plugins, Andrew Fasano, 2022/09/01
- [RFC 4/4] tcg/plugins: Add example pair of QPP plugins, Andrew Fasano, 2022/09/01
- [RFC 3/4] tcg/plugins: Support for inter-plugin interactions, Andrew Fasano, 2022/09/01
- [RFC 2/4] tcg/plugins: Automatically define CURRENT_PLUGIN, Andrew Fasano, 2022/09/01
- Re: [RFC 2/4] tcg/plugins: Automatically define CURRENT_PLUGIN,
Alex Bennée <=
- [RFC 1/4] docs/tcg-plugins: describe QPP API, Andrew Fasano, 2022/09/01
- Re: [RFC 0/4] Support interactions between TCG plugins, Alex Bennée, 2022/09/21