diff options
author | mischief <mischief@offblast.org> | 2015-08-05 06:26:23 -0700 |
---|---|---|
committer | mischief <mischief@offblast.org> | 2015-08-05 06:26:23 -0700 |
commit | 7844dafe621c7151a301220948edf494af2b8af9 (patch) | |
tree | ba83101d93cc1388d1b85adb4072ad455089c4ce /sys/src/libmach | |
parent | 8ce456bd195c0ddfa18ce87f68a4447689c18489 (diff) |
libmach: set correct endianness with little endian ELF32 mips binaries
Diffstat (limited to 'sys/src/libmach')
-rw-r--r-- | sys/src/libmach/executable.c | 12 |
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; |