Re: [PATCH v2 03/18] modules: add qemu-modinfo utility

2021-06-16 Thread Paolo Bonzini
On 16/06/21 11:16, Gerd Hoffmann wrote: I was almost giving up... but it looks like the result of extract_all_objects(recursive: true) can be passed to custom_target(). Then you can match it after compile_commands.json's "output" key. Seems the custom_target commands do not land in

Re: [PATCH v2 03/18] modules: add qemu-modinfo utility

2021-06-16 Thread Gerd Hoffmann
On Tue, Jun 15, 2021 at 03:35:44PM +0200, Paolo Bonzini wrote: > On 15/06/21 15:07, Gerd Hoffmann wrote: > > > Hmm, looks like I actually need both. Seems there is no easy way to get > > > the cflags out of a source_set to construct a cpp command line. Pulling > > > this out of

Re: [PATCH v2 03/18] modules: add qemu-modinfo utility

2021-06-15 Thread Paolo Bonzini
On 15/06/21 15:07, Gerd Hoffmann wrote: Hmm, looks like I actually need both. Seems there is no easy way to get the cflags out of a source_set to construct a cpp command line. Pulling this out of compile_commands.json with jq works though. Well, easy until I look at target-specific modules

Re: [PATCH v2 03/18] modules: add qemu-modinfo utility

2021-06-15 Thread Gerd Hoffmann
> > > A Python script could parse compile_commands.json, add -E -DQEMU_MODINFO > > > to > > > the command-line option, and look in the output for the metadata. > > > > Hmm, worth trying, although I guess it would be easier to code this up > > straight in meson.build and pull the information you

Re: [PATCH v2 03/18] modules: add qemu-modinfo utility

2021-06-15 Thread Daniel P . Berrangé
On Tue, Jun 15, 2021 at 06:54:41AM +0200, Gerd Hoffmann wrote: > > > Problem with that approach is that it doesn't work for module > > > dependencies ... > > > > > > Comments on the idea? Suggestions for the module dependency problem? > > > Could maybe libbfd be used to find module (symbol)

Re: [PATCH v2 03/18] modules: add qemu-modinfo utility

2021-06-15 Thread Gerd Hoffmann
On Tue, Jun 15, 2021 at 06:49:15AM +0200, Gerd Hoffmann wrote: > Hi, > > > Another possibility to eschew .o parsing is to add something like this to > > the sources > > > > #ifdef QEMU_MODINFO > > #define MODULE_METADATA(key, value) \ > >=<>= MODINFO key value > > #else > > #define

Re: [PATCH v2 03/18] modules: add qemu-modinfo utility

2021-06-14 Thread Gerd Hoffmann
> > Problem with that approach is that it doesn't work for module > > dependencies ... > > > > Comments on the idea? Suggestions for the module dependency problem? > > Could maybe libbfd be used to find module (symbol) dependencies > > automatically without writing a full dynamic linker? > > Is

Re: [PATCH v2 03/18] modules: add qemu-modinfo utility

2021-06-14 Thread Gerd Hoffmann
Hi, > Another possibility to eschew .o parsing is to add something like this to > the sources > > #ifdef QEMU_MODINFO > #define MODULE_METADATA(key, value) \ >=<>= MODINFO key value > #else > #define MODULE_METADATA(key, value) > #endif > > MODULE_METADATA("opts", "spice") > > A Python

Re: [PATCH v2 03/18] modules: add qemu-modinfo utility

2021-06-14 Thread Daniel P . Berrangé
On Mon, Jun 14, 2021 at 05:01:59PM +0200, Gerd Hoffmann wrote: > Hi, > > > > softmmu_mods and block_mods are both lists already, so this sets a > > > nested list and I wonder if it confuses meson ? eg do you need > > > > > > input: softmmu_mods + block_mods > > > > No, that should be fine.

Re: [PATCH v2 03/18] modules: add qemu-modinfo utility

2021-06-14 Thread Gerd Hoffmann
Hi, > > softmmu_mods and block_mods are both lists already, so this sets a > > nested list and I wonder if it confuses meson ? eg do you need > > > > input: softmmu_mods + block_mods > > No, that should be fine. Perhaps it's because the inputs are not part of > the command? You can check

Re: [PATCH v2 03/18] modules: add qemu-modinfo utility

2021-06-14 Thread Paolo Bonzini
On 14/06/21 10:34, Paolo Bonzini wrote: - modinfo.json needs to be disabled on non-ELF platforms (x86, Windows).  One alternative is to use libbfd instead of including an ELF parser. - If modinfo.json has to be installed, you need to build modinfo for the build machine in order to support

Re: [PATCH v2 03/18] modules: add qemu-modinfo utility

2021-06-14 Thread Paolo Bonzini
On 10/06/21 15:13, Daniel P. Berrangé wrote: On Thu, Jun 10, 2021 at 03:04:24PM +0200, Gerd Hoffmann wrote: Hi Paolo, +if config_host.has_key('CONFIG_MODULES') + qemu_modinfo = executable('qemu-modinfo', files('qemu-modinfo.c') + genh, + dependencies: [glib,

Re: [PATCH v2 03/18] modules: add qemu-modinfo utility

2021-06-10 Thread Daniel P . Berrangé
On Thu, Jun 10, 2021 at 03:04:24PM +0200, Gerd Hoffmann wrote: > Hi Paolo, > > > +if config_host.has_key('CONFIG_MODULES') > > + qemu_modinfo = executable('qemu-modinfo', files('qemu-modinfo.c') + > > genh, > > + dependencies: [glib, qemuutil], install: > >

Re: [PATCH v2 03/18] modules: add qemu-modinfo utility

2021-06-10 Thread Gerd Hoffmann
Hi Paolo, > +if config_host.has_key('CONFIG_MODULES') > + qemu_modinfo = executable('qemu-modinfo', files('qemu-modinfo.c') + genh, > + dependencies: [glib, qemuutil], install: > have_tools) > + custom_target('modinfo.json', > + input: [

[PATCH v2 03/18] modules: add qemu-modinfo utility

2021-06-10 Thread Gerd Hoffmann
Scan .modinfo sections of qemu modules, write module metadata to modinfo.json. Signed-off-by: Gerd Hoffmann --- qemu-modinfo.c | 270 + meson.build| 11 ++ 2 files changed, 281 insertions(+) create mode 100644 qemu-modinfo.c diff --git