OSDN Git Service

qemu-binfmt-conf.sh: mips: allow nonzero EI_ABIVERSION, distinguish o32 and n32
authorAndreas K. Hüttel <dilfridge@gentoo.org>
Mon, 28 Mar 2022 20:49:01 +0000 (22:49 +0200)
committerPhilippe Mathieu-Daudé <f4bug@amsat.org>
Mon, 28 Mar 2022 22:51:55 +0000 (00:51 +0200)
commit77d119dd335f910c7f953a265726e3753c69a0bb
treea76e13d729baad6525878323bfb49bd496c655f4
parent8cd0e66353018f63322e0dd200b2d31be265f883
qemu-binfmt-conf.sh: mips: allow nonzero EI_ABIVERSION, distinguish o32 and n32

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>
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é <f4bug@amsat.org>
Closes: https://gitlab.com/qemu-project/qemu/-/issues/843
Message-Id: <20220328204900.3914990-1-dilfridge@gentoo.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
scripts/qemu-binfmt-conf.sh