From: "Philippe Mathieu-Daudé" <philippe.mathieu.daude@gmail.com>
To: "Andreas K. Hüttel" <dilfridge@gentoo.org>,
qemu-devel@nongnu.org, "Laurent Vivier" <laurent@vivier.eu>
Cc: "Alex Bennee" <alex.bennee@linaro.org>,
"WANG Xuerui" <xen0n@gentoo.org>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: Re: [PATCH for-7.0 v5] qemu-binfmt-conf.sh: mips: allow nonzero EI_ABIVERSION, distinguish o32 and n32
Date: Tue, 29 Mar 2022 01:39:33 +0200 [thread overview]
Message-ID: <e3a30b1a-69ab-9e69-4722-c8aa056a8c97@gmail.com> (raw)
In-Reply-To: <20220328204900.3914990-1-dilfridge@gentoo.org>
On 28/3/22 22:49, Andreas K. Hüttel wrote:
> With the command line flag -mplt and a recent toolchain, ELF binaries
> generated by gcc can obtain EI_ABIVERSION=1, which makes, e.g., gcc
> three-stage bootstrap in a mips-unknown-linux-gnu qemu-user chroot
> fail since the binfmt-misc magic does not match anymore. Also other
> values are technically possible. qemu executes these binaries just
> fine, so relax the mask for the EI_ABIVERSION byte at offset 0x08.
>
> In addition, extend magic string to distinguish mips o32 and n32 ABI.
> This information is given by the EF_MIPS_ABI2 (0x20) bit in the
> e_flags field of the ELF header (a 4-byte value at offset 0x24 for
> the here applicable ELFCLASS32).
>
> See-also: ace3d65459
> Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> Reviewed-by: WANG Xuerui <xen0n@gentoo.org>
v5 changes are too different from v4 to keep these R-b tags IMO.
LGTM but I'd like Xuerui to double-check the R-b stands,
and an Acked-by from Laurent would make me feel safer ;)
> Cc: Laurent Vivier <laurent@vivier.eu>
> Cc: WANG Xuerui <xen0n@gentoo.org>
> Cc: Richard Henderson <richard.henderson@linaro.org>
> Cc: Alex Bennee <alex.bennee@linaro.org>
> Cc: Philippe Mathieu-Daudé <philippe.mathieu.daude@gmail.com>
> Closes: https://gitlab.com/qemu-project/qemu/-/issues/843
> ---
>
> v5: Fully relax mask for EI_ABIVERSION for all of mips; squash patches
> since they touch the same lines
> v4: Unchanged repost of v3
> v3: Add the magic extension to distinguish n32 and o32
> v2: Add the same EI_ABIVERSION fix for little endian as for big endian
> v1: Initial version, only handling EI_ABIVERSION=1 on BE
>
> scripts/qemu-binfmt-conf.sh | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
> index e9bfeb94d3..9cb723f443 100755
> --- a/scripts/qemu-binfmt-conf.sh
> +++ b/scripts/qemu-binfmt-conf.sh
> @@ -60,28 +60,28 @@ m68k_family=m68k
>
> # FIXME: We could use the other endianness on a MIPS host.
>
> -mips_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08'
> -mips_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
> +mips_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
> +mips_mask='\xff\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20'
> mips_family=mips
>
> -mipsel_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00'
> -mipsel_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
> +mipsel_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
> +mipsel_mask='\xff\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00'
> mipsel_family=mips
>
> -mipsn32_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08'
> -mipsn32_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
> +mipsn32_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20'
> +mipsn32_mask='\xff\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20'
> mipsn32_family=mips
>
> -mipsn32el_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00'
> -mipsn32el_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
> +mipsn32el_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00'
> +mipsn32el_mask='\xff\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00'
> mipsn32el_family=mips
>
> mips64_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08'
> -mips64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
> +mips64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
> mips64_family=mips
>
> mips64el_magic='\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00'
> -mips64el_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
> +mips64el_mask='\xff\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
> mips64el_family=mips
>
> sh4_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a\x00'
next prev parent reply other threads:[~2022-03-28 23:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-28 20:49 [PATCH for-7.0 v5] qemu-binfmt-conf.sh: mips: allow nonzero EI_ABIVERSION, distinguish o32 and n32 Andreas K. Hüttel
2022-03-28 23:39 ` Philippe Mathieu-Daudé [this message]
2022-03-29 2:05 ` WANG Xuerui
2022-03-29 10:30 ` Philippe Mathieu-Daudé
2022-03-29 11:35 ` 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=e3a30b1a-69ab-9e69-4722-c8aa056a8c97@gmail.com \
--to=philippe.mathieu.daude@gmail.com \
--cc=alex.bennee@linaro.org \
--cc=dilfridge@gentoo.org \
--cc=f4bug@amsat.org \
--cc=laurent@vivier.eu \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=xen0n@gentoo.org \
/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).