On Sun, 2026-11-01 at 11:15 +0800, Tan Chi wrote: > hw/riscv/device-common.c is built unconditionally, although its > helpers are only used by the virt and server reference machines. > > In minimal builds without these machines, device-common.c can > reference device implementations that are not built, resulting > in an undefined reference to gpex_set_irq_num(). > > Introduce CONFIG_RISCV_DEVICE_COMMON and select it from the two > machines that use these helpers. Build device-common.c only > when this option is enabled. > > Signed-off-by: Tan Chi <[email protected]>
Reviewed-by: Alistair Francis <[email protected]> Alistair > --- > hw/riscv/Kconfig | 5 +++++ > hw/riscv/meson.build | 2 +- > 2 files changed, 6 insertions(+), 1 deletion(-) > > diff --git a/hw/riscv/Kconfig b/hw/riscv/Kconfig > index fb05031228..27f03b687c 100644 > --- a/hw/riscv/Kconfig > +++ b/hw/riscv/Kconfig > @@ -7,6 +7,9 @@ config RISCV_NUMA > config IBEX > bool > > +config RISCV_DEVICE_COMMON > + bool > + > # RISC-V machines in alphabetical order > > config MICROCHIP_PFSOC > @@ -68,6 +71,7 @@ config RISCV_VIRT > select PLATFORM_BUS > select ACPI > select ACPI_PCI > + select RISCV_DEVICE_COMMON > > config RISCV_SERVER_PLATFORM_REF > bool > @@ -85,6 +89,7 @@ config RISCV_SERVER_PLATFORM_REF > select RISCV_IOMMU > select RISCV_NUMA > select SERIAL_MM > + select RISCV_DEVICE_COMMON > > config SHAKTI_C > bool > diff --git a/hw/riscv/meson.build b/hw/riscv/meson.build > index 957031c07d..b60108787d 100644 > --- a/hw/riscv/meson.build > +++ b/hw/riscv/meson.build > @@ -2,7 +2,7 @@ riscv_ss = ss.source_set() > riscv_ss.add(when: ['CONFIG_RISCV_APLIC', 'CONFIG_RISCV_IMSIC'], > if_true: files('aia.c')) > riscv_ss.add(files('boot.c')) > -riscv_ss.add(files('device-common.c')) > +riscv_ss.add(when: 'CONFIG_RISCV_DEVICE_COMMON', if_true: > files('device-common.c')) > riscv_ss.add(files('fdt-common.c')) > riscv_ss.add(when: 'CONFIG_RISCV_NUMA', if_true: files('numa.c')) > riscv_ss.add(files('riscv_hart.c'))
