qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: "Alex Bennée" <alex.bennee@linaro.org>,
	"Aleksandar Markovic" <aleksandar.m.mail@gmail.com>
Cc: peter.maydell@linaro.org, Riku Voipio <riku.voipio@iki.fi>,
	qemu-devel@nongnu.org, qemu-arm@nongnu.org,
	Laurent Vivier <laurent@vivier.eu>
Subject: Re: [Qemu-devel] [PATCH v1 4/4] elf: move ELF_ARCH definition to elf-arch.h
Date: Sat, 14 Sep 2019 11:52:58 -0400	[thread overview]
Message-ID: <5880b9c9-969f-fa79-f7f4-a45a6568635e@linaro.org> (raw)
In-Reply-To: <874l1j18vm.fsf@linaro.org>

On 9/11/19 5:26 AM, Alex Bennée wrote:
> 
> Aleksandar Markovic <aleksandar.m.mail@gmail.com> writes:
> 
>> 10.09.2019. 21.34, "Alex Bennée" <alex.bennee@linaro.org> је написао/ла:
>>>
>>> This is preparatory for plugins which will want to report the
>>> architecture to plugins. Move the ELF_ARCH definition out of the
>>> loader and into its own header.
>>>
>>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>>> --
>>
>> Hi, Alex.
>>
>> I advice some caution here
>> . For example, EM_NANOMIPS, and some other EM_xxx constants are not
>> included in the new header.
> 
> EM_ARCH was never set to EM_NANOMIPS. In fact I can see e_machine is
> checked against it so I guess it is only ever used to checking the
> loading elf directly.
> 
> In fact EM_ARCH is only really the default fallback case for checking
> the elf type if there is not a more "forgiving" check done by arch
> specific code (elf_check_arch). The only other cace is the fallback for
> EM_MACHINE unless PPC does something with it.
> 
>> I am not sure what exactly you want to achieve
>> with this refactoring. But you may miss your goal, since some EM_xxx will
>> be missing from your new header. Is this the right way to achieve what you
>> want, and could you unintentionally introduce bugs? Can you outline in more
>> details your intentions around the new header? Is this refactoring the only
>> way?
> 
> As mentioned in the other reply maybe exposing a value from configure
> into config-target.[mak|h] would be a better approach?

I think using EM_FOO to tell a plugin about the architecture is just going to
be confusing.  As seen here wrt EM_NANOMIPS, but arguably elsewhere with
EM_SPARC vs EM_SPARC64.

You need to decide what it is that you want the plugin to know.  It is just be
gross architecture?  In which case QEMU_ARCH_FOO is probably enough.  Is it the
instruction set currently executing?  In which case neither EM_FOO nor
QEMU_ARCH_FOO is sufficient -- e.g. arm thumb -- and you'll have to invent
something new, because no two architectures handle this in the same way.  The
closest you might be able to get without invention from whole cloth is the
capstone cap_arch+cap_mode values from cc->disas_set_info().  But that only
handles the most popular of targets.

In any case, a single header that every target must touch is the wrong
approach.  If you want to do some cleanup, move these defines into e.g.
linux-user/$TARGET/target_elf.h.  (And I wouldn't bother touching bsd-user in
its current condition.)


r~


  parent reply	other threads:[~2019-09-14 15:55 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-10 19:34 [Qemu-devel] [PATCH v1 0/4] ELF and (macro) safety Alex Bennée
2019-09-10 19:34 ` [Qemu-devel] [PATCH v1 1/4] target/ppc: fix signal delivery for ppc64abi32 Alex Bennée
2019-09-10 19:45   ` Alex Bennée
2019-09-10 19:34 ` [Qemu-devel] [PATCH v1 2/4] elf: move elf.h to elf/elf.h and split out types Alex Bennée
2019-09-11  0:08   ` David Gibson
2019-09-11  8:29   ` BALATON Zoltan
2019-09-11  9:19     ` Alex Bennée
2019-09-14 18:15   ` Richard Henderson
2019-10-21 13:53   ` Laurent Vivier
2019-10-21 14:04     ` Peter Maydell
2019-09-10 19:34 ` [Qemu-devel] [PATCH v1 3/4] elf: move elf_ops.h into include/elf/ and rename Alex Bennée
2019-09-11  8:20   ` Alex Bennée
2019-09-14 18:16     ` Richard Henderson
2019-10-21 13:56   ` Laurent Vivier
2019-09-10 19:34 ` [Qemu-devel] [PATCH v1 4/4] elf: move ELF_ARCH definition to elf-arch.h Alex Bennée
2019-09-10 21:14   ` Aleksandar Markovic
2019-09-11  9:26     ` Alex Bennée
2019-09-13 14:45       ` Aleksandar Markovic
2019-09-14 15:52       ` Richard Henderson [this message]
2019-09-14 17:51         ` Alex Bennée
2019-09-14 18:19           ` Richard Henderson
2019-09-10 21:39   ` Aleksandar Markovic
2019-09-11  8:19     ` Alex Bennée
2019-10-21 14:03   ` Laurent Vivier

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=5880b9c9-969f-fa79-f7f4-a45a6568635e@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=aleksandar.m.mail@gmail.com \
    --cc=alex.bennee@linaro.org \
    --cc=laurent@vivier.eu \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /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).