[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] linux-user: warn if trying to use qemu-mipsn32[el] with non n32
From: |
Carlo Marcelo Arenas Belón |
Subject: |
[PATCH] linux-user: warn if trying to use qemu-mipsn32[el] with non n32 ELF |
Date: |
Fri, 21 Aug 2020 15:28:30 -0700 |
While technically compatible will (depending on the CPU) hopefully fail
later with a cryptic error:
qemu: Unexpected FPU mode
Provide an earlier hint of what the problem might be by detecting if the
binary might not be using the n32 ABI and print a warning.
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
linux-user/elfload.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index fe9dfe795d..64c3921cd9 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -2390,6 +2390,13 @@ static void load_elf_image(const char *image_name, int
image_fd,
if (!elf_check_ehdr(ehdr)) {
goto exit_errmsg;
}
+#ifdef TARGET_ABI_MIPSN32
+/* from arch/mips/include/asm/elf.h */
+#define EF_MIPS_ABI2 0x00000020
+ if (!(ehdr->e_flags & EF_MIPS_ABI2)) {
+ fprintf(stderr, "warning: ELF binary missing n32 flag\n");
+ }
+#endif
i = ehdr->e_phnum * sizeof(struct elf_phdr);
if (ehdr->e_phoff + i <= BPRM_BUF_SIZE) {
--
2.28.0.213.gdd9653da77
- [PATCH] linux-user: warn if trying to use qemu-mipsn32[el] with non n32 ELF,
Carlo Marcelo Arenas Belón <=