diff options
author | Gabe Black <gblack@eecs.umich.edu> | 2008-03-20 02:10:21 -0400 |
---|---|---|
committer | Gabe Black <gblack@eecs.umich.edu> | 2008-03-20 02:10:21 -0400 |
commit | 3fe1af795243b42bd957d5fc6f243bb63f603f7d (patch) | |
tree | a7f7abb0eb47582256fda87624ea4c9adc1f8b78 /src/base | |
parent | 3de8a78a04b1d1c5e901f3613b6247da9cf00a9c (diff) | |
download | gem5-3fe1af795243b42bd957d5fc6f243bb63f603f7d.tar.xz |
MIPS: Check endianness of binaries in SE mode.
--HG--
extra : convert_revision : e6c4bda6078eb68a26f8834411f744078c6bf5a9
Diffstat (limited to 'src/base')
-rw-r--r-- | src/base/loader/elf_object.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/base/loader/elf_object.cc b/src/base/loader/elf_object.cc index 8e41ffd16..4c3f694e5 100644 --- a/src/base/loader/elf_object.cc +++ b/src/base/loader/elf_object.cc @@ -79,7 +79,13 @@ ElfObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data) arch = ObjectFile::SPARC32; } else if (ehdr.e_machine == EM_MIPS && ehdr.e_ident[EI_CLASS] == ELFCLASS32) { - arch = ObjectFile::Mips; + if (ehdr.e_ident[EI_DATA] == ELFDATA2LSB) { + arch = ObjectFile::Mips; + } else { + fatal("The binary you're trying to load is compiled for big " + "endian MIPS. M5\nonly supports little endian MIPS. " + "Please recompile your binary.\n"); + } } else if (ehdr.e_machine == EM_X86_64 && ehdr.e_ident[EI_CLASS] == ELFCLASS64) { //In the future, we might want to differentiate between 32 bit |