qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>, qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Thomas Huth <thuth@redhat.com>,
	Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>,
	Aurelien Jarno <aurelien@aurel32.net>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [RFC PATCH] target/mips: Allow building without Inter-Thread Communication hardware
Date: Tue, 27 Apr 2021 15:13:03 -0700	[thread overview]
Message-ID: <f48f0433-9608-3cc6-8a9a-6eef8c213c7b@linaro.org> (raw)
In-Reply-To: <20210427191152.260421-1-f4bug@amsat.org>

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	other threads:[~2021-04-27 22:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-27 19:11 [RFC PATCH] target/mips: Allow building without Inter-Thread Communication hardware Philippe Mathieu-Daudé
2021-04-27 22:13 ` Richard Henderson [this message]
2021-05-22 12:32   ` Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f48f0433-9608-3cc6-8a9a-6eef8c213c7b@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=aleksandar.rikalo@syrmia.com \
    --cc=aurelien@aurel32.net \
    --cc=f4bug@amsat.org \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).