Since commit 9808ce6d5cb, building QEMU configured with
'--without-default-devices' fails:

  Undefined symbols for architecture arm64:
    "_pnv_chip_find_core", referenced from:
        _helper_load_sprd in target_ppc_misc_helper.c.o
        _helper_store_sprd in target_ppc_misc_helper.c.o
  ld: symbol(s) not found for architecture arm64
  clang: error: linker command failed with exit code 1

Fix by adding a stub when CONFIG_POWERNV is not available.

Reported-by: Thomas Huth <th...@redhat.com>
Fixes: 9808ce6d5cb ("target/ppc: Big-core scratch register fix")
Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org>
---
 hw/ppc/pnv_stub.c  | 15 +++++++++++++++
 hw/ppc/meson.build |  3 ++-
 2 files changed, 17 insertions(+), 1 deletion(-)
 create mode 100644 hw/ppc/pnv_stub.c

diff --git a/hw/ppc/pnv_stub.c b/hw/ppc/pnv_stub.c
new file mode 100644
index 00000000000..8d11c8b65bb
--- /dev/null
+++ b/hw/ppc/pnv_stub.c
@@ -0,0 +1,15 @@
+/*
+ * QEMU PowerPC PowerNV stubs
+ *
+ *  Copyright (c) Linaro
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "hw/ppc/pnv.h"
+
+PnvCore *pnv_chip_find_core(PnvChip *chip, uint32_t core_id)
+{
+    g_assert_not_reached();
+}
diff --git a/hw/ppc/meson.build b/hw/ppc/meson.build
index 9893f8adebb..02f248f5f46 100644
--- a/hw/ppc/meson.build
+++ b/hw/ppc/meson.build
@@ -55,7 +55,8 @@ ppc_ss.add(when: 'CONFIG_POWERNV', if_true: files(
   'pnv_pnor.c',
   'pnv_nest_pervasive.c',
   'pnv_n1_chiplet.c',
-))
+), if_false: files('pnv_stub.c'))
+
 # PowerPC 4xx boards
 ppc_ss.add(when: 'CONFIG_PPC440', if_true: files(
   'ppc440_bamboo.c',
-- 
2.47.1


Reply via email to