Message ID | 20230223231755.81633-7-philmd@linaro.org |
---|---|
State | New |
Headers | show |
Series | dump: Make most of it target agnostic (build once) | expand |
On 2/23/23 13:17, Philippe Mathieu-Daudé wrote: > Extract non-x86 stubs to win_dump-stub.c. We can now > build dump.o once for system emulation. Update meson. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> > --- > dump/dump.c | 14 -------------- > dump/meson.build | 6 ++++-- > dump/win_dump-stub.c | 23 +++++++++++++++++++++++ > 3 files changed, 27 insertions(+), 16 deletions(-) > create mode 100644 dump/win_dump-stub.c > > diff --git a/dump/dump.c b/dump/dump.c > index b33a613d45..7cde3e326e 100644 > --- a/dump/dump.c > +++ b/dump/dump.c > @@ -32,20 +32,6 @@ > #include "migration/blocker.h" > #include "win_dump.h" > > -#ifndef TARGET_X86_64 > -bool win_dump_available(Error **errp) > -{ > - error_setg(errp, "Windows dump is only available for x86-64"); > - > - return false; > -} > - > -void create_win_dump(DumpState *s, Error **errp) > -{ > - win_dump_available(errp); > -} > -#endif > - > #include <zlib.h> > #ifdef CONFIG_LZO > #include <lzo/lzo1x.h> > diff --git a/dump/meson.build b/dump/meson.build > index 2eff29c3ea..6ae07e6fed 100644 > --- a/dump/meson.build > +++ b/dump/meson.build > @@ -1,4 +1,6 @@ > softmmu_ss.add(files('dump-hmp-cmds.c')) > > -specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: [files('dump.c'), snappy, lzo]) > -specific_ss.add(when: ['CONFIG_SOFTMMU', 'TARGET_X86_64'], if_true: files('win_dump.c')) > +softmmu_ss.add(when: 'CONFIG_SOFTMMU', if_true: [files('dump.c'), snappy, lzo]) > +specific_ss.add(when: ['CONFIG_SOFTMMU', 'TARGET_X86_64'], > + if_true: files('win_dump.c'), > + if_false: files('win_dump-stub.c')) Doesn't this add win_dump-stub.c when !(SOFTMMU && X86_64), i.e. !SOFTMMU || !X86_64? I trying to imagine how well this will scale with ARM64, for the ongoing Windows on ARM project. Would it just be easier have the stubs in win_dump.c, using ifdefs? r~
On 24/2/23 00:51, Richard Henderson wrote: > On 2/23/23 13:17, Philippe Mathieu-Daudé wrote: >> Extract non-x86 stubs to win_dump-stub.c. We can now >> build dump.o once for system emulation. Update meson. >> >> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> >> --- >> dump/dump.c | 14 -------------- >> dump/meson.build | 6 ++++-- >> dump/win_dump-stub.c | 23 +++++++++++++++++++++++ >> 3 files changed, 27 insertions(+), 16 deletions(-) >> create mode 100644 dump/win_dump-stub.c >> diff --git a/dump/meson.build b/dump/meson.build >> index 2eff29c3ea..6ae07e6fed 100644 >> --- a/dump/meson.build >> +++ b/dump/meson.build >> @@ -1,4 +1,6 @@ >> softmmu_ss.add(files('dump-hmp-cmds.c')) >> -specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: [files('dump.c'), >> snappy, lzo]) >> -specific_ss.add(when: ['CONFIG_SOFTMMU', 'TARGET_X86_64'], if_true: >> files('win_dump.c')) >> +softmmu_ss.add(when: 'CONFIG_SOFTMMU', if_true: [files('dump.c'), >> snappy, lzo]) >> +specific_ss.add(when: ['CONFIG_SOFTMMU', 'TARGET_X86_64'], >> + if_true: files('win_dump.c'), >> + if_false: files('win_dump-stub.c')) > > Doesn't this add win_dump-stub.c when !(SOFTMMU && X86_64), i.e. > !SOFTMMU || !X86_64? > > I trying to imagine how well this will scale with ARM64, for the ongoing > Windows on ARM project. Would it just be easier have the stubs in > win_dump.c, using ifdefs? Yeah I realized that later, keeping one single file with #ifdef'ry even simplifies meson rules. I over-engineered that :) Also various methods from win_dump.c could be reused.
diff --git a/dump/dump.c b/dump/dump.c index b33a613d45..7cde3e326e 100644 --- a/dump/dump.c +++ b/dump/dump.c @@ -32,20 +32,6 @@ #include "migration/blocker.h" #include "win_dump.h" -#ifndef TARGET_X86_64 -bool win_dump_available(Error **errp) -{ - error_setg(errp, "Windows dump is only available for x86-64"); - - return false; -} - -void create_win_dump(DumpState *s, Error **errp) -{ - win_dump_available(errp); -} -#endif - #include <zlib.h> #ifdef CONFIG_LZO #include <lzo/lzo1x.h> diff --git a/dump/meson.build b/dump/meson.build index 2eff29c3ea..6ae07e6fed 100644 --- a/dump/meson.build +++ b/dump/meson.build @@ -1,4 +1,6 @@ softmmu_ss.add(files('dump-hmp-cmds.c')) -specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: [files('dump.c'), snappy, lzo]) -specific_ss.add(when: ['CONFIG_SOFTMMU', 'TARGET_X86_64'], if_true: files('win_dump.c')) +softmmu_ss.add(when: 'CONFIG_SOFTMMU', if_true: [files('dump.c'), snappy, lzo]) +specific_ss.add(when: ['CONFIG_SOFTMMU', 'TARGET_X86_64'], + if_true: files('win_dump.c'), + if_false: files('win_dump-stub.c')) diff --git a/dump/win_dump-stub.c b/dump/win_dump-stub.c new file mode 100644 index 0000000000..87cb699e3d --- /dev/null +++ b/dump/win_dump-stub.c @@ -0,0 +1,23 @@ +/* + * Windows crashdump stubs for non-x86 targets + * + * Copyright (c) 2023 Linaro Ltd + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "win_dump.h" + +bool win_dump_available(Error **errp) +{ + error_setg(errp, "Windows dump is only available for x86-64"); + + return false; +} + +void create_win_dump(DumpState *s, Error **errp) +{ + win_dump_available(errp); +}
Extract non-x86 stubs to win_dump-stub.c. We can now build dump.o once for system emulation. Update meson. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- dump/dump.c | 14 -------------- dump/meson.build | 6 ++++-- dump/win_dump-stub.c | 23 +++++++++++++++++++++++ 3 files changed, 27 insertions(+), 16 deletions(-) create mode 100644 dump/win_dump-stub.c