qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH] target/mips: Allow building without Inter-Thread Communi


From: Richard Henderson
Subject: Re: [RFC PATCH] target/mips: Allow building without Inter-Thread Communication hardware
Date: Tue, 27 Apr 2021 15:13:03 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1

On 4/27/21 12:11 PM, Philippe Mathieu-Daudé wrote:
The Inter-Thread Communication unit (TYPE_MIPS_ITU) is an optional
device that is only selected by a few machines. However it goes
deep into the translation code, as the MTC0/MTHC0 SAAR helpers
call itc_reconfigure().

When building with no machine selecting the ITU component (which
is implemented in hw/misc/mips_itu.c), we get the following link
failure:

   /usr/bin/ld: target_mips_cp0_helper.c.o: in function `helper_mtc0_saar':
   target/mips/cp0_helper.c:1118: undefined reference to `itc_reconfigure'
   /usr/bin/ld: target_mips_cp0_helper.c.o: in function `helper_mthc0_saar':
   target/mips/cp0_helper.c:1135: undefined reference to `itc_reconfigure'

Fix by adding a stub, built when the ITU isn't selected.

Signed-off-by: Philippe Mathieu-Daudé<f4bug@amsat.org>
---
RFC because too much Meson machinery to my taste.
But how to deal with such architectural devices else?

To reproduce:

$ echo CONFIG_JAZZ=y > default-configs/devices/mips64el-softmmu.mak
$ echo CONFIG_SEMIHOSTING=y >> default-configs/devices/mips64el-softmmu.mak
$ configure --without-default-devices
$ ninja qemu-system-mips64el
$ ./qemu-system-mips64el -M magnum -S
---
  target/mips/cp0_itu-stub.c | 15 +++++++++++++++
  target/mips/meson.build    |  3 +++
  2 files changed, 18 insertions(+)
  create mode 100644 target/mips/cp0_itu-stub.c

Perhaps use __attribute__((weak)) on itc_reconfigure? Then you don't need the stub at all. You're already protecting the actual call, so there should be no change needed there.

We're not using weak so far, but as far as I can tell this is supported by gcc on windows as well.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]