On 22/9/26 13:56, Daniel P. Berrangé wrote:
If CONFIG_CXL=n is added to the Kconfig, the build fails to link
the PXB device:

/usr/bin/ld.bfd: libsystem.a.p/hw_pci-bridge_pci_expander_bridge.c.o: in 
function `pxb_cxl_realize':
/home/berrange/src/virt/qemu/build/../hw/pci-bridge/pci_expander_bridge.c:202:(.text+0x330):
 undefined reference to `cxl_component_register_block_init'
/usr/bin/ld.bfd: libsystem.a.p/hw_pci-bridge_pci_expander_bridge.c.o: in 
function `pxb_cxl_dev_reset':
/home/berrange/src/virt/qemu/build/../hw/pci-bridge/pci_expander_bridge.c:309:(.text+0x768):
 undefined reference to `cxl_component_register_init_common'

Fixes: 6e4e3ae936 (hw/cxl/component: Implement host bridge MMIO (8.2.5, table 
142))
Signed-off-by: Daniel P. Berrangé <[email protected]>
---
  hw/pci-bridge/pci_expander_bridge.c | 14 ++++++++++++--
  1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/hw/pci-bridge/pci_expander_bridge.c 
b/hw/pci-bridge/pci_expander_bridge.c
index 40ffbc4e082..8977243a804 100644
--- a/hw/pci-bridge/pci_expander_bridge.c
+++ b/hw/pci-bridge/pci_expander_bridge.c
@@ -123,12 +123,14 @@ static const TypeInfo pxb_pcie_bus_info = {
      .class_init    = pxb_bus_class_init,
  };
+#ifdef CONFIG_CXL
  static const TypeInfo pxb_cxl_bus_info = {
      .name          = TYPE_PXB_CXL_BUS,
      .parent        = TYPE_CXL_BUS,
      .instance_size = sizeof(PXBBus),
      .class_init    = pxb_bus_class_init,
  };
+#endif /* CONFIG_CXL */
This does not build:

FAILED: libsystem.a.p/hw_pci-bridge_pci_expander_bridge.c.o
../hw/pci-bridge/pci_expander_bridge.c:126:8: error: attempt to use poisoned "CONFIG_CXL"
  126 | #ifdef CONFIG_CXL
      |        ^


Reply via email to