qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: Aleksandar Markovic <amarkovic@wavecomp.com>,
	Richard Henderson <rth@twiddle.net>,
	Peter Maydell <peter.maydell@linaro.org>
Cc: "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 13:30:27 +0200	[thread overview]
Message-ID: <5368d20b-2b39-2fee-8851-f749f97071f8@vivier.eu> (raw)
In-Reply-To: <BN7PR08MB4868F5BE2EBF580CE8F1C244C65D0@BN7PR08MB4868.namprd08.prod.outlook.com>

Le 16/07/2018 à 13:10, Aleksandar Markovic a écrit :
> Hello, all.
> 
> 
> Just a little background:
> 
> 
> One of the fields in an ELF header is e_machine. It is meant to contain
> "machine architecture". The numerical value is approved by a committee.
> Some values for common targets are: EM_PPC, EM_PPC64, EM_ARM,
> EM_AARCH64, etc.
> 
> 
> The TCG function tcg_register_jit_int() expects that the preprocessor
> constant ELF_HOST_MACHINE is defined, and uses internally the value of
> that constant.
> 
> 
> Consider, let's say, ARM: It definesELF_HOST_MACHINE in
> tcg/arm/tcg-target.inc.c as
> 
> 
> #define ELF_HOST_MACHINE EM_ARM
> 
> 
> while in tcg/aarch64/tcg-target.inc.c it defines it as
> 
> 
> #define ELF_HOST_MACHINE EM_AARCH64
> 
> 
> 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

Thanks,
Laurent

  reply	other threads:[~2018-07-16 11:30 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 [this message]
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
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=5368d20b-2b39-2fee-8851-f749f97071f8@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).