@samitouri / QOSamiQemu / commits / 2fa22ab7fe

hw/*: Build stubs once

Move stubs to the global stub_ss[] source set. These files are now built once for all binaries, instead of one time per system binary. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20260225035739.42848-10-philmd@linaro.org>

Philippe Mathieu-Daudé committed Feb 24, 2026 at 17:26 UTC 2fa22ab7fe5a1ca4e0c2daecbe0a676e44d55aa8
7 files changed +16 -21
hw/cxl/meson.build
+2 -2
@@ -7,7 +7,7 @@ system_ss.add(when: 'CONFIG_CXL',
7 'cxl-cdat.c',
8 'cxl-events.c',
9 'switch-mailbox-cci.c',
10 - ),
11 - if_false: files(
10 + ))
11 +stub_ss.add(files(
12 'cxl-host-stubs.c',
13 ))
hw/i386/kvm/meson.build
+1 -4
@@ -15,9 +15,6 @@ i386_kvm_ss.add(when: 'CONFIG_XEN_EMU', if_true: files(
15
16 i386_ss.add_all(when: 'CONFIG_KVM', if_true: i386_kvm_ss)
17
18 -xen_stubs_ss = ss.source_set()
19 -xen_stubs_ss.add(when: 'CONFIG_XEN_EMU', if_false: files(
18 +stub_ss.add(files(
19 'xen-stubs.c',
20 ))
22 -
23 -specific_ss.add_all(when: 'CONFIG_SYSTEM_ONLY', if_true: xen_stubs_ss)
hw/mem/meson.build
+2 -2
@@ -4,9 +4,9 @@ mem_ss.add(when: 'CONFIG_DIMM', if_true: files('pc-dimm.c'))
4 mem_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx_mc.c'))
5 mem_ss.add(when: 'CONFIG_NVDIMM', if_true: files('nvdimm.c'))
6 mem_ss.add(when: 'CONFIG_CXL_MEM_DEVICE', if_true: files('cxl_type3.c'))
7 -system_ss.add(when: 'CONFIG_CXL_MEM_DEVICE', if_false: files('cxl_type3_stubs.c'))
7 +stub_ss.add(files('cxl_type3_stubs.c'))
8
9 -system_ss.add(when: 'CONFIG_MEM_DEVICE', if_false: files('memory-device-stubs.c'))
9 +stub_ss.add(files('memory-device-stubs.c'))
10 system_ss.add_all(when: 'CONFIG_MEM_DEVICE', if_true: mem_ss)
11
12 system_ss.add(when: 'CONFIG_SPARSE_MEM', if_true: files('sparse-mem.c'))
hw/pci/meson.build
+1 -1
@@ -19,4 +19,4 @@ pci_ss.add(files('pcie_doe.c'))
19 system_ss.add(when: 'CONFIG_PCI_EXPRESS', if_true: files('pcie_port.c', 'pcie_host.c'))
20 system_ss.add_all(when: 'CONFIG_PCI', if_true: pci_ss)
21
22 -system_ss.add(when: 'CONFIG_PCI', if_false: files('pci-stub.c'))
22 +stub_ss.add(files('pci-stub.c'))
hw/smbios/meson.build
+5 -5
@@ -1,12 +1,12 @@
1 smbios_ss = ss.source_set()
2 smbios_ss.add(files('smbios.c'))
3 smbios_ss.add(when: 'CONFIG_IPMI',
4 - if_true: files('smbios_type_38.c'),
5 - if_false: files('smbios_type_38-stub.c'))
4 + if_true: files('smbios_type_38.c'))
5 +stub_ss.add(files('smbios_type_38-stub.c'))
6
7 smbios_ss.add(when: 'CONFIG_SMBIOS_LEGACY',
8 - if_true: files('smbios_legacy.c'),
9 - if_false: files('smbios_legacy_stub.c'))
8 + if_true: files('smbios_legacy.c'))
9 +stub_ss.add(files('smbios_legacy_stub.c'))
10
11 system_ss.add_all(when: 'CONFIG_SMBIOS', if_true: smbios_ss)
12 -system_ss.add(when: 'CONFIG_SMBIOS', if_false: files('smbios-stub.c'))
12 +stub_ss.add(files('smbios-stub.c'))
hw/usb/meson.build
+2 -1
@@ -9,7 +9,8 @@ system_ss.add(when: 'CONFIG_USB', if_true: files(
9 'desc-msos.c',
10 'libhw.c',
11 'pcap.c',
12 -), if_false: files('bus-stub.c'))
12 +))
13 +stub_ss.add(files('bus-stub.c'))
14
15 # usb host adapters
16 system_ss.add(when: 'CONFIG_USB_UHCI', if_true: files('hcd-uhci.c'))
hw/virtio/meson.build
+3 -6
@@ -48,8 +48,6 @@ if have_vhost
48 system_virtio_ss.add(files('vhost-vdpa.c'))
49 system_virtio_ss.add(files('vhost-shadow-virtqueue.c'))
50 endif
51 -else
52 - system_virtio_ss.add(files('vhost-stub.c'))
51 endif
52 system_virtio_ss.add(when: 'CONFIG_VHOST_USER_VSOCK', if_true: files('vhost-user-vsock.c'))
53 system_virtio_ss.add(when: 'CONFIG_VIRTIO_RNG', if_true: files('virtio-rng.c'))
@@ -92,10 +90,9 @@ virtio_pci_ss.add(when: 'CONFIG_VIRTIO_MD', if_true: files('virtio-md-pci.c'))
90 system_virtio_ss.add_all(when: 'CONFIG_VIRTIO_PCI', if_true: virtio_pci_ss)
91
92 system_ss.add_all(when: 'CONFIG_VIRTIO', if_true: system_virtio_ss)
95 -system_ss.add(when: 'CONFIG_VIRTIO', if_false: files('vhost-stub.c'))
96 -system_ss.add(when: 'CONFIG_VIRTIO', if_false: files('virtio-stub.c'))
97 -system_ss.add(when: ['CONFIG_VIRTIO_MD', 'CONFIG_VIRTIO_PCI'],
98 - if_false: files('virtio-md-stubs.c'))
93 +stub_ss.add(files('vhost-stub.c'))
94 +stub_ss.add(files('virtio-stub.c'))
95 +stub_ss.add(files('virtio-md-stubs.c'))
96
97 system_ss.add(files('virtio-hmp-cmds.c'))
98