From: Laurent Vivier <laurent@vivier.eu>
To: Aleksandar Markovic <amarkovic@wavecomp.com>,
Peter Maydell <peter.maydell@linaro.org>
Cc: Richard Henderson <rth@twiddle.net>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
Petar Jovanovic <pjovanovic@wavecomp.com>,
Riku Voipio <riku.voipio@iki.fi>,
Stefan Markovic <smarkovic@wavecomp.com>
Subject: Re: [Qemu-devel] tcg_register_jit_int() interface problem
Date: Mon, 16 Jul 2018 15:04:58 +0200 [thread overview]
Message-ID: <945b2112-83e6-47eb-a70f-190846b4150e@vivier.eu> (raw)
In-Reply-To: <BN7PR08MB4868051FE8DADE7A1CA8A62AC65D0@BN7PR08MB4868.namprd08.prod.outlook.com>
Le 16/07/2018 à 14:55, Aleksandar Markovic a écrit :
>> From: Peter Maydell <peter.maydell@linaro.org>
>> Sent: Monday, July 16, 2018 1:55 PM
>>
>> On 16 July 2018 at 12:36, Aleksandar Markovic <amarkovic@wavecomp.com>
> wrote:
>> >> From: Laurent Vivier <laurent@vivier.eu>
>> >> Le 16/07/2018 à 13:10, Aleksandar Markovic a écrit :
>> >> > For MIPS, the situation is different: Up until recently, MIPS had
> only
>> >> > one value for e_machine: that was EM_MIPS (used for both 32-bit and
>> >> > 64-bit MIPS systems). However, new nanoMIPS systems have a new
> value in
>> >> > that field: EM_NANOMIPS (that is to be applied for both 32-bit and
>> >> > 64-bit nanoMIPS systems).
>> >> >
>> >> >
>> >> > The situation described above represent a problem for us developing
>> >> > nanoMIPS support, forcing us to have different compilations (and
>> >> > executables) for MIPS and nanoMIPS.
>> >> >
>> >> >
>> >> > Is there a possibility to refactor tcg_register_jit_int() to receive
>> >> > "e_machine" value as an argument, instead of expecting preprocessor
>> >> > constant to be set?
>> >>
>> >> I don't know this par of code, but for PPC we have:
>> >>
>> >> #if TCG_TARGET_REG_BITS == 64
>> >> # define ELF_HOST_MACHINE EM_PPC64
>> >> #else
>> >> # define ELF_HOST_MACHINE EM_PPC
>> >> #endif
>> >>
>> >> So perhaps you could have something like:
>> >>
>> >> #if defined(HOST_NANOMIPS)
>> >> # define ELF_HOST_MACHINE EM_NANOMIPS
>> >> #else
>> >> # define ELF_HOST_MACHINE EM_MIPS
>> >> #endif
>> >
>> > The problem is, this means there will be separate executables for
> QEMU for
>> > MIPS and QEMU for nanoMIPS. Would that be acceptable from overall QEMU
>> > design point of view? Peter, Richard?
>>
>> The assumption has previously been that there must be a value known
>> at compile time (because it would be the value of whatever is in the
>> ELF header for the QEMU executable itself, effectively). I'm not
>> sure why this doesn't work for MIPS still -- if you're building
>> on a host with the new nanoMIPS stuff and with that support enabled,
>> then report EM_NANOMIPS; if you're building a binary that works with
>> the older MIPS CPUs, report EM_MIPS ?
>>
>> That said, if this doesn't work for MIPS, then it would be a trivial
>> refactor to allow the tcg per-target code to do
>> #define ELF_HOST_MACHINE mips_get_elf_host_machine()
>> so you could compute the value at runtime.
>>
>
> Thanks for hints and suggestions. I will have to revisit the code and
> find the most suitable solution.
Does this mean an EM_NANOMIPS binary can be run on an EM_MIPS machine
and vice-versa?
Thanks,
Laurent
next prev parent reply other threads:[~2018-07-16 13:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-16 11:10 [Qemu-devel] tcg_register_jit_int() interface problem Aleksandar Markovic
2018-07-16 11:30 ` Laurent Vivier
2018-07-16 11:36 ` Aleksandar Markovic
2018-07-16 11:55 ` Peter Maydell
2018-07-16 12:55 ` Aleksandar Markovic
2018-07-16 13:04 ` Laurent Vivier [this message]
2018-07-16 13:23 ` Aleksandar Markovic
2018-07-16 15:06 ` Richard Henderson
2018-07-16 15:04 ` Richard Henderson
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=945b2112-83e6-47eb-a70f-190846b4150e@vivier.eu \
--to=laurent@vivier.eu \
--cc=amarkovic@wavecomp.com \
--cc=peter.maydell@linaro.org \
--cc=pjovanovic@wavecomp.com \
--cc=qemu-devel@nongnu.org \
--cc=riku.voipio@iki.fi \
--cc=rth@twiddle.net \
--cc=smarkovic@wavecomp.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).