summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--elf_ops.h17
-rw-r--r--target-ppc/cpu.h3
2 files changed, 16 insertions, 4 deletions
diff --git a/elf_ops.h b/elf_ops.h
index feea12f261..485442a935 100644
--- a/elf_ops.h
+++ b/elf_ops.h
@@ -194,8 +194,21 @@ static int glue(load_elf, SZ)(int fd, int64_t address_offset,
glue(bswap_ehdr, SZ)(&ehdr);
}
- if (ELF_MACHINE != ehdr.e_machine)
- goto fail;
+ switch (ELF_MACHINE) {
+ case EM_PPC64:
+ if (EM_PPC64 != ehdr.e_machine)
+ if (EM_PPC != ehdr.e_machine)
+ goto fail;
+ break;
+ case EM_X86_64:
+ if (EM_X86_64 != ehdr.e_machine)
+ if (EM_386 != ehdr.e_machine)
+ goto fail;
+ break;
+ default:
+ if (ELF_MACHINE != ehdr.e_machine)
+ goto fail;
+ }
if (pentry)
*pentry = (uint64_t)(elf_sword)ehdr.e_entry;
diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h
index 77cf6de71e..87b34600ed 100644
--- a/target-ppc/cpu.h
+++ b/target-ppc/cpu.h
@@ -68,8 +68,7 @@
#define TARGET_HAS_ICE 1
-/* Load a 32 bit BIOS also on 64 bit machines */
-#if defined (TARGET_PPC64) && defined(CONFIG_USER_ONLY)
+#if defined (TARGET_PPC64)
#define ELF_MACHINE EM_PPC64
#else
#define ELF_MACHINE EM_PPC