Philippe Mathieu-Daudé <phi...@redhat.com> writes:
> 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 I'm still not convinced we should be adding support for stuff being done outside the normal build process... that said... > $ 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 <mreza...@redhat.com> > Signed-off-by: Philippe Mathieu-Daudé <phi...@redhat.com> > --- > target/arm/Makefile.objs | 3 ++- > target/arm/arm-semi-stubs.c | 21 +++++++++++++++++++++ > 2 files changed, 23 insertions(+), 1 deletion(-) > create mode 100644 target/arm/arm-semi-stubs.c > > diff --git a/target/arm/Makefile.objs b/target/arm/Makefile.objs > index 6bdcc65c2c..39b02b1fa4 100644 > --- a/target/arm/Makefile.objs > +++ b/target/arm/Makefile.objs > @@ -1,4 +1,5 @@ > -obj-y += arm-semi.o > +obj-$(CONFIG_SEMIHOSTING) += arm-semi.o > +obj-$(call lnot,$(CONFIG_SEMIHOSTING)) += arm-semi-stubs.o > obj-$(CONFIG_SOFTMMU) += machine.o psci.o arch_dump.o monitor.o > obj-$(CONFIG_KVM) += kvm.o > obj-$(call land,$(CONFIG_KVM),$(call lnot,$(TARGET_AARCH64))) += kvm32.o > diff --git a/target/arm/arm-semi-stubs.c b/target/arm/arm-semi-stubs.c > new file mode 100644 > index 0000000000..a91ecbd9d5 > --- /dev/null > +++ b/target/arm/arm-semi-stubs.c > @@ -0,0 +1,21 @@ > +/* > + * Arm "Angel" semihosting stubs > + * > + * Copyright (c) 2019 Red Hat, Inc. > + * > + * Author: > + * Philippe Mathieu-Daudé <phi...@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(); > +} Could this not just be added to arm-semi.c in an #ifndef CONFIG_SEMIHOSTING target_ulong do_arm_semihosting(CPUARMState *env) { g_assert_not_reached(); } #else ... rest of arm-semi.c.... #endif -- Alex Bennée