@@ -1,6 +1,6 @@
# Default configuration for arm-softmmu
-# CONFIG_SEMIHOSTING is always required on this architecture
+# CONFIG_SEMIHOSTING is not required on KVM only builds
CONFIG_SEMIHOSTING=y
# TODO: ARM_V7M is currently always required - make this more flexible!
@@ -1,4 +1,5 @@
-obj-$(CONFIG_TCG) += arm-semi.o
+obj-$(CONFIG_SEMIHOSTING) += arm-semi.o
+obj-$(call lnot,$(CONFIG_SEMIHOSTING)) += arm-semi-stubs.o
obj-y += helper.o vfp_helper.o
obj-y += cpu.o gdbstub.o
obj-$(TARGET_AARCH64) += cpu64.o gdbstub64.o
new file mode 100644
@@ -0,0 +1,21 @@
+/*
+ * Arm "Angel" semihosting stubs
+ *
+ * Copyright (c) 2019 Red Hat, Inc.
+ *
+ * Author:
+ * Philippe Mathieu-Daudé <philmd@redhat.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "cpu.h"
+
+target_ulong do_arm_semihosting(CPUARMState *env)
+{
+ g_assert_not_reached();
+}
If a distribution wants to build QEMU without semihosting support, it currently gets this build failure: $ ./configure --target-list=aarch64-softmmu --without-default-devices $ sed -i s/CONFIG_SEMIHOSTING=y/CONFIG_SEMIHOSTING=n/ default-configs/arm-softmmu.mak $ make subdir-aarch64-softmmu [...] LINK aarch64-softmmu/qemu-system-aarch64 /usr/bin/ld: target/arm/arm-semi.o: in function `do_arm_semihosting': ./target/arm/arm-semi.c:321: undefined reference to `qemu_semihosting_console_out' /usr/bin/ld: ./target/arm/arm-semi.c:318: undefined reference to `qemu_semihosting_console_out' collect2: error: ld returned 1 exit status make[1]: *** [Makefile:204: qemu-system-aarch64] Error 1 make: *** [Makefile:472: subdir-aarch64-softmmu] Error 2 Fix it by providing a stub when semihosting is disabled. Reported-by: Miroslav Rezanina <mrezanin@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> --- default-configs/arm-softmmu.mak | 2 +- target/arm/Makefile.objs | 3 ++- target/arm/arm-semi-stubs.c | 21 +++++++++++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 target/arm/arm-semi-stubs.c