summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/src/libmach/executable.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/src/libmach/executable.c b/sys/src/libmach/executable.c
index 4dbe94d92..c5b2e652d 100644
--- a/sys/src/libmach/executable.c
+++ b/sys/src/libmach/executable.c
@@ -733,8 +733,16 @@ elf32dotout(int fd, Fhdr *fp, ExecHdr *hp)
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;