[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-arm] [RFC PATCH 1/2] target/arm: Add stubs to build with CONFI
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [Qemu-arm] [RFC PATCH 1/2] target/arm: Add stubs to build with CONFIG_SEMIHOSTING disabled |
Date: |
Tue, 18 Jun 2019 14:02:53 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 |
On 6/17/19 5:33 PM, Philippe Mathieu-Daudé wrote:
> On 6/17/19 5:19 PM, Alex Bennée wrote:
>> Philippe Mathieu-Daudé <address@hidden> 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...
>
> If the "KVM/TCG split" series is accepted, then we can add a
> --disable-tcg job in the list of "normal builds" and we don't need this
> particular patch.
>
>> 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 <address@hidden>
>>> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
>>> ---
>>> 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é <address@hidden>
>>> + *
>>> + * 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
Note that CONFIG_SEMIHOSTING is a Make definition, not a CPP one,
and it doesn't look straight forward to get it added to config-target.h...