ref: 7844dafe621c7151a301220948edf494af2b8af9
parent: 8ce456bd195c0ddfa18ce87f68a4447689c18489
author: mischief <mischief@offblast.org>
date: Wed Aug 5 02:26:23 EDT 2015
libmach: set correct endianness with little endian ELF32 mips binaries
--- a/sys/src/libmach/executable.c
+++ b/sys/src/libmach/executable.c
@@ -733,8 +733,16 @@
break;
case MIPS:
mach = &mmips;
- fp->type = FMIPS;
- fp->name = "mips ELF32 executable";
+ if(ep->ident[DATA] == ELFDATA2LSB){
+ fp->type = FMIPSLE;
+ fp->name = "mips le ELF32 executable";
+ } else if(ep->ident[DATA] == ELFDATA2MSB){
+ fp->type = FMIPS;
+ fp->name = "mips be ELF32 executable";
+ } else {
+ werrstr("bad ELF32 encoding - not big or little endian");
+ return 0;
+ }
break;
case SPARC64:
mach = &msparc64;