Rather than compiling the same content for all targets (unused most of the time, i.e. qemu-system-avr ...), build it once per POSIX hosts. Check Windows host (less likely) before x86 host.
Signed-off-by: Philippe Mathieu-Daudé <[email protected]> --- dump/win_dump-stubs.c | 21 +++++++++++++++++++++ dump/win_dump.c | 12 ++++++++---- dump/meson.build | 6 +++++- 3 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 dump/win_dump-stubs.c diff --git a/dump/win_dump-stubs.c b/dump/win_dump-stubs.c new file mode 100644 index 00000000000..722c66740a2 --- /dev/null +++ b/dump/win_dump-stubs.c @@ -0,0 +1,21 @@ +/* + * Windows crashdump stubs + * + * 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 on Windows"); + + return false; +} + +void create_win_dump(DumpState *s, Error **errp) +{ + g_assert_not_reached(); +} diff --git a/dump/win_dump.c b/dump/win_dump.c index 6e07913dfb4..5b2b55d9ff7 100644 --- a/dump/win_dump.c +++ b/dump/win_dump.c @@ -12,14 +12,16 @@ #include "system/dump.h" #include "qapi/error.h" #include "qemu/error-report.h" +#include "win_dump.h" + +#ifdef CONFIG_WIN32 +#if defined(TARGET_X86_64) + #include "exec/cpu-defs.h" #include "hw/core/cpu.h" #include "qemu/win_dump_defs.h" -#include "win_dump.h" #include "cpu.h" -#if defined(TARGET_X86_64) - bool win_dump_available(Error **errp) { return true; @@ -478,7 +480,9 @@ out_cr3: first_x86_cpu->env.cr[3] = saved_cr3; } -#else /* !TARGET_X86_64 */ +#endif /* !TARGET_X86_64 */ + +#else /* !CONFIG_WIN32 */ bool win_dump_available(Error **errp) { diff --git a/dump/meson.build b/dump/meson.build index 4277ce9328a..0aaf3f65d9c 100644 --- a/dump/meson.build +++ b/dump/meson.build @@ -1,2 +1,6 @@ system_ss.add([files('dump.c', 'dump-hmp-cmds.c'), snappy, lzo]) -specific_ss.add(when: 'CONFIG_SYSTEM_ONLY', if_true: files('win_dump.c')) +if host_os == 'windows' + system_ss.add(files('win_dump.c')) +else + system_ss.add(files('win_dump-stubs.c')) +endif -- 2.52.0
