summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAleksandar Rikalo <arikalo@wavecomp.com>2018-08-07 13:03:13 +0200
committerAleksandar Markovic <amarkovic@wavecomp.com>2018-08-24 17:51:59 +0200
commit56f26045dc00c8ac370735afb1dec72e9c4dbd98 (patch)
treec2722cc61e46a3ef1055d63bc1520b16a003dd39
parentf72541f3a595e27242e12175650ad09fdbeda296 (diff)
downloadfocaccia-qemu-56f26045dc00c8ac370735afb1dec72e9c4dbd98.tar.gz
focaccia-qemu-56f26045dc00c8ac370735afb1dec72e9c4dbd98.zip
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 <richard.henderson@linaro.org>
Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Stefan Markovic <smarkovic@wavecomp.com>
-rw-r--r--include/hw/elf_ops.h8
1 files changed, 8 insertions, 0 deletions
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;