diff mbox series

[v8,61/87] elf: On elf loading, treat both EM_MIPS and EM_NANOMIPS as legal for MIPS

Message ID 1534182832-554-62-git-send-email-aleksandar.markovic@rt-rk.com
State New
Headers show
Series Add nanoMIPS support to QEMU | expand

Commit Message

Aleksandar Markovic Aug. 13, 2018, 5:53 p.m. UTC
From: Aleksandar Rikalo <arikalo@wavecomp.com>

Modify load_elf32()/load_elf64() to treat EM_NANOMIPS as equal to
EM_MIPS.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Stefan Markovic <smarkovic@wavecomp.com>
---
 include/hw/elf_ops.h | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Aleksandar Markovic Aug. 16, 2018, 12:28 p.m. UTC | #1
> From: Aleksandar Markovic <aleksandar.markovic@rt-rk.com>
> Sent: Monday, August 13, 2018 7:53 PM
> 
> Subject: [PATCH v8 61/87] elf: On elf loading, treat both EM_MIPS and EM_NANOMIPS as legal for MIPS
> 
> From: Aleksandar Rikalo <arikalo@wavecomp.com>
> 
> Modify load_elf32()/load_elf64() to treat EM_NANOMIPS as equal to
> EM_MIPS.
> 
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> Signed-off-by: Stefan Markovic <smarkovic@wavecomp.com>
> ---
>  include/hw/elf_ops.h | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/include/hw/elf_ops.h b/include/hw/elf_ops.h
> index b6e19e3..81cecaf 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;
> --
> 2.7.4
> 


Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
diff mbox series

Patch

diff --git a/include/hw/elf_ops.h b/include/hw/elf_ops.h
index b6e19e3..81cecaf 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;