From 2a94de07706a702a65fed50a837f7a76d452ae05 Mon Sep 17 00:00:00 2001 From: Aleksandar Rikalo Date: Mon, 13 Aug 2018 17:34:05 +0200 Subject: elf: Add EM_NANOMIPS value as a valid one for e_machine field Value 249 is registered as valid for usage for nanoMIPS executables. Reviewed-by: Richard Henderson Reviewed-by: Aleksandar Markovic Signed-off-by: Aleksandar Markovic Signed-off-by: Stefan Markovic --- include/elf.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/elf.h b/include/elf.h index 28a5a638e0..312f68af81 100644 --- a/include/elf.h +++ b/include/elf.h @@ -143,6 +143,8 @@ typedef int64_t Elf64_Sxword; #define EM_RISCV 243 /* RISC-V */ +#define EM_NANOMIPS 249 /* Wave Computing nanoMIPS */ + /* * This is an interim value that we will use until the committee comes * up with a final number. -- cgit v1.2.3-70-g09d2 From 56f26045dc00c8ac370735afb1dec72e9c4dbd98 Mon Sep 17 00:00:00 2001 From: Aleksandar Rikalo Date: Tue, 7 Aug 2018 13:03:13 +0200 Subject: elf: On elf loading, treat both EM_MIPS and EM_NANOMIPS as legal for MIPS Modify load_elf32()/load_elf64() to treat EM_NANOMIPS as legal as EM_MIPS is. Reviewed-by: Richard Henderson Reviewed-by: Aleksandar Markovic Signed-off-by: Aleksandar Markovic Signed-off-by: Stefan Markovic --- include/hw/elf_ops.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include') diff --git a/include/hw/elf_ops.h b/include/hw/elf_ops.h index b6e19e35d0..81cecaf27e 100644 --- a/include/hw/elf_ops.h +++ b/include/hw/elf_ops.h @@ -327,6 +327,14 @@ static int glue(load_elf, SZ)(const char *name, int fd, } } break; + case EM_MIPS: + case EM_NANOMIPS: + if ((ehdr.e_machine != EM_MIPS) && + (ehdr.e_machine != EM_NANOMIPS)) { + ret = ELF_LOAD_WRONG_ARCH; + goto fail; + } + break; default: if (elf_machine != ehdr.e_machine) { ret = ELF_LOAD_WRONG_ARCH; -- cgit v1.2.3-70-g09d2