changeset c76aca1a8b5f in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=c76aca1a8b5f
summary: MIPS: Check endianness of binaries in SE mode.
diffstat:
1 file changed, 7 insertions(+), 1 deletion(-)
src/base/loader/elf_object.cc | 8 +++++++-
diffs (18 lines):
diff -r f910b095a3a5 -r c76aca1a8b5f src/base/loader/elf_object.cc
--- a/src/base/loader/elf_object.cc Mon Mar 17 23:07:22 2008 -0400
+++ b/src/base/loader/elf_object.cc Thu Mar 20 02:10:21 2008 -0400
@@ -79,7 +79,13 @@ ElfObject::tryFile(const string &fname,
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
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev