]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
dump: Build stubs once for non-x86 targets
authorPhilippe Mathieu-Daudé <philmd@linaro.org>
Sun, 4 Jan 2026 17:41:12 +0000 (18:41 +0100)
committerPhilippe Mathieu-Daudé <philmd@linaro.org>
Thu, 22 Jan 2026 09:48:46 +0000 (10:48 +0100)
Rather than compiling the same content for all targets (unused
most of the time, i.e. qemu-system-avr ...), extract the non
x86 specific parts to a stub file and build it once for all
non-x86 targets.

Add a Kconfig symbol to only select the target-specific file
with the x86 target (rename this file with '-x86' suffix).

Since Kconfig symbols aren't evaluated for user emulation,
the file unit is only built for system emulation.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260121215622.92966-3-philmd@linaro.org>

Kconfig
dump/Kconfig [new file with mode: 0644]
dump/meson.build
dump/win_dump-stubs.c [new file with mode: 0644]
dump/win_dump-x86.c [moved from dump/win_dump.c with 97% similarity]

diff --git a/Kconfig b/Kconfig
index 63ca7f46df788144864b26ef5a64b29ad6547435..26388c1283851671b78b54c3872dbfa98ddea795 100644 (file)
--- a/Kconfig
+++ b/Kconfig
@@ -1,6 +1,7 @@
 source Kconfig.host
 source backends/Kconfig
 source accel/Kconfig
+source dump/Kconfig
 source target/Kconfig
 source hw/Kconfig
 source semihosting/Kconfig
diff --git a/dump/Kconfig b/dump/Kconfig
new file mode 100644 (file)
index 0000000..4b59dbb
--- /dev/null
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+config WINDUMP
+    bool
+    default y if X86_64
+    depends on X86_64
index 4277ce9328a3c41f21ca4b8fa1836e5dfa000f30..26e1561ed48623cef5dd4b261400abb7ea64564e 100644 (file)
@@ -1,2 +1,3 @@
 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'))
+specific_ss.add(when: 'CONFIG_WINDUMP', if_true: files('win_dump-x86.c'))
+system_ss.add(when: 'CONFIG_WINDUMP', if_false: files('win_dump-stubs.c'))
diff --git a/dump/win_dump-stubs.c b/dump/win_dump-stubs.c
new file mode 100644 (file)
index 0000000..96c1095
--- /dev/null
@@ -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, "x86-64 Windows guest dump not built-in");
+
+    return false;
+}
+
+void create_win_dump(DumpState *s, Error **errp)
+{
+    g_assert_not_reached();
+}
similarity index 97%
rename from dump/win_dump.c
rename to dump/win_dump-x86.c
index 6e07913dfb4ca0e42d1cb5c59c6fab0b57935414..d893dea7f199afc6d4140bf5a317d9aac89f2b7f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Windows crashdump (target specific implementations)
+ * Windows crashdump (x86 specific implementations)
  *
  * Copyright (c) 2018 Virtuozzo International GmbH
  *
@@ -18,8 +18,6 @@
 #include "win_dump.h"
 #include "cpu.h"
 
-#if defined(TARGET_X86_64)
-
 bool win_dump_available(Error **errp)
 {
     return true;
@@ -477,19 +475,3 @@ out_free:
 out_cr3:
     first_x86_cpu->env.cr[3] = saved_cr3;
 }
-
-#else /* !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)
-{
-    g_assert_not_reached();
-}
-
-#endif