So i want to disassemble and then run a MIPS elf file for the first time. As i don't have MIPS hardware i am using mipsel-unknown-linux-gnu toolchain.Here comes the problem. The output of the command file myelf is:
ELF 32-bit LSB executable, MIPS, MIPS-I version 1 (SYSV), statically linked (uses shared libs), stripped
But when i try to disassemble the file i get:
mipsel-unknown-linux-gnu-objdump: myelf: File format not recognized
I get the same error when i want to run it or to debug it. But if i write a small program in MIPS assembly (using an edit and mipsel-unknown-linux-gnu-as as assembler and mipsel-unknown-linux-gnu-ld as a linker) i can run it and debug it so i'm sure the problem comes from myelf file. Actually i can disassemble myelf with IDA but i want to follow the execution using gdb under linux.
Then i did a readelf and this is the output of mipsel-unknown-linux--u-readelf -a myelf:
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: MIPS R3000
Version: 0x1
Entry point address: 0x400670
Start of program headers: 52 (bytes into file)
Start of section headers: 4132 (bytes into file)
Flags: 0x1007, noreorder, pic, cpic, o32, mips1
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 9
Size of section headers: 40 (bytes)
Number of section headers: 30
Section header string table index: 29
readelf: Error: Unable to read in 0x69737265 bytes of string table
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] <no-name> LOUSER+6f0fbdbf bdbfefbd bdbfef3b f286821 bfef4abd WAXxMSLOTxxxxxxxxop 1992146927 4022190063 3220159935
readelf: Warning: section 0: sh_link value of 1992146927 is larger than the number of sections
[ 1] <no-name> 09bdbfef: <unkn bfefbdbf bfef58bd ef3d6ebd ef5d6e20 WAXxSILOGTxxxxxxxop 3220159935 3220134333 1483756221
readelf: Warning: section 1: sh_link value of 3220159935 is larger than the number of sections
[ 2] <no-name> LOUSER+3dbfefbd bfef1257 ef1e67bd bfefbdbf efbdbfef WAXIOGTxxxxxxxxop 3183472573 1589493743 3183472479
readelf: Warning: section 2: sh_link value of 3183472573 is larger than the number of sections
[ 3] <no-name> LOUSER+3fefbdbf bfef35bd bfef51bd bfef07bd bdbfef38 WXxMSLOGxxxxxxop 4017489853 1393212863 498974703
readelf: Warning: section 3: sh_link value of 4017489853 is larger than the number of sections
[ 4] <no-name> LOUSER+3dbfef7c 25bdbfef 44bdbfef efbdbfef efbdbfef WAXOGTxxxxxxxxop 4013997503 4014390719 1532607935
readelf: Warning: section 4: sh_link value of 4013997503 is larger than the number of sections
[ 5] <no-name> LOUSER+6f17bdbf bfef1fbd ef3d6dbd 2b4ebdbf ef3a332c WAXxMSLOTxxxxxxxxop 700301295 3183472475 3183472441
readelf: Warning: section 5: sh_link value of 700301295 is larger than the number of sections
[ 6] <no-name> LOUSER+6f15bdbf ef0f15bd bfefbdbf bdbfefbd bfef4e90 WAXxMSLOTxxxxxxxxop 3220132880 3220113853 3661197501
readelf: Warning: section 6: sh_link value of 3220132880 is larger than the number of sections
[ 7] <no-name> LOUSER+6f1c2e62 64bdbfef 4a3d369 ef603c51 ef40bdbf WAXxMSLOTxxxxxxop 1366867391 700301295 4011659522
readelf: Warning: section 7: sh_link value of 1366867391 is larger than the number of sections
[ 8] <no-name> 4c2cbdbf: <unkn bdbfefbd bfef3c4f ef476cbd ef1d10bd AXMSIOGTxxxxxxop 386514367 3183472428 3220142970
readelf: Warning: section 8: sh_link value of 386514367 is larger than the number of sections
[ 9] <no-name> LOUSER+24c2bdbf 42781f57 efb4a5e5 bfefbdbf 716bdbf WAXxSILOGTxxxxxxxop 3183472573 4012516894 4016422335
readelf: Warning: section 9: sh_link value of 3183472573 is larger than the number of sections
[10] <no-name> LOUSER+3fefbdbf 476e0abd 18bdbfef bdbfef32 4bdbfef WXxMSLGxxxxxxop 3183472447 4022190063 525516223
readelf: Warning: section 10: sh_link value of 3183472447 is larger than the number of sections
[11] <no-name> LOUSER+3dbfef0f bdbfef35 ef5a2137 5415bdbf efbdbfef AMIOGTxxxxxxxxop 3220117023 3183472573 3183472496
readelf: Warning: section 11: sh_link value of 3220117023 is larger than the number of sections
[12] <no-name> LOUSER+3dbfefbd 80dc78ae efbdbfef bfefbdbf bdbfefbd AXxTxxxop 3220115133 4015879101 3220159935
readelf: Warning: section 12: sh_link value of 3220115133 is larger than the number of sections
[13] <no-name> LOUSER+3dbfef4a cf6622bd bdbfef89 77bdbfef ef714abd WASIOTxxxxxop 3220122624 3220140989 3220129981
readelf: Warning: section 13: sh_link value of 3220122624 is larger than the number of sections
[14] <no-name> LOUSER+6f202b35 5b1a78bd efbdbfef bfefbdbf ef37bdbf WAXxMSLOTxxxxxxxxop 3183472573 3183472489 4022190063
readelf: Warning: section 14: sh_link value of 3183472573 is larger than the number of sections
[15] <no-name> 2a0e3fbd: <unkn efbdbfef ef3abdbf ef15bdbf bfefbdbf WxOGTxxxxxxxxop 4013014463 4012883391 4014063039
readelf: Warning: section 15: sh_link value of 4013014463 is larger than the number of sections
[16] <no-name> LOUSER+6fbdbfef bfefbdbf bdbfefbd 3fbdbfef ef0961bd WAXxMSLOTxxxxxxop 1899399115 3183472494 3220112411
readelf: Warning: section 16: sh_link value of 1899399115 is larger than the number of sections
[17] <no-name> 185a7404: <unkn 0038bdbf 4abdbfef bdbfef09 9631ebd WAXxMSOGxxxxop 985513967 4010489125 3220159935
readelf: Warning: section 17: sh_link value of 985513967 is larger than the number of sections
[18] <no-name> LOUSER+6fa4db38 00bdbfef 000000 000000 bfef0000 WAXxMSLOTxxxxxop 0 0 0
[19] <no-name> 410c3000: <unkn 00000000 000000 bdbfef00 7000400b 4009771013 1074249151 3183472384
readelf: Warning: section 19: sh_link value of 4009771013 is larger than the number of sections
[20] <no-name> 0000400b: <unkn ef00400b 4009bdbf 400b4000 00 p 1074475008 1074470912 1074466816
readelf: Warning: section 20: sh_link value of 1074475008 is larger than the number of sections
[21] <no-name> LOUSER+3dbfef00 0000400b ef000000 4007bdbf bdbfefbd Wxx 117440512 4022190063 3220159935
readelf: Warning: section 21: sh_link value of 117440512 is larger than the number of sections
[22] <no-name> NULL 1d000000 1f000000 ef000000 bfefbdbf p 1074314687 0 4022190063
readelf: Warning: section 22: sh_link value of 1074314687 is larger than the number of sections
[23] <no-name> 00bdbfef: <unkn 20000000 1d000000 1f000000 00 4009754624 1074380223 0
readelf: Warning: section 23: sh_link value of 4009754624 is larger than the number of sections
[24] <no-name> NULL 00001d00 001f00 bdbfef00 efbdbfef 16393 3220127488 3183472573
readelf: Warning: section 24: sh_link value of 16393 is larger than the number of sections
[25] <no-name> 000000bd: <unkn 00003800 001d00 001f00 2e34206e 1128482560 1143480378 1634296421
readelf: Warning: section 25: sh_link value of 1128482560 is larger than the number of sections
[26] <no-name> 34202938: <unkn 000f4100 6e670000 7010075 626174 AXxSTxxxxxop 67108864 1932394497 1920234344
readelf: Warning: section 26: sh_link value of 67108864 is larger than the number of sections
[27] <no-name> 00707265: <unkn 42412e65 61742d49 722e0067 756e672e AXxSGTxxxxxxxop 1852401509 771780454 1702129518
readelf: Warning: section 27: sh_link value of 1852401509 is larger than the number of sections
[28] <no-name> LOOS+92d646c 6d616e79 2e006369 68736168 7274736e XSIxxxop 2036608512 1836675950 2036608512
readelf: Warning: section 28: sh_link value of 2036608512 is larger than the number of sections
[29] <no-name> LOOS+5762e75 672e006e 762e756e 69737265 74786574 AMSIOGxxxxxop 1918856815 1852386816 771781737
readelf: Warning: section 29: sh_link value of 1918856815 is larger than the number of sections
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings)
I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
O (extra OS processing required) o (OS specific), p (processor specific)
There are no section groups in this file.
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
PHDR 0x000034 0x00400034 0x00400034 0x00120 0x00120 R E 0x4
INTERP 0x000154 0x00400154 0x00400154 0x0000a 0x0000a R 0x1
[Requesting program interpreter: ]
REGINFO 0x1bdbfef 0xbfef0000 0x004001bd 0x1bdbfef 0x180040 0x40000
<unknown>: 400 0x010000 0x00000000 0x00000000 0x00040 0xc300040 0x50000
NULL 0x010001 0x0c300000 0x0c300000 0xc300041 0x2400041 0x60000
NULL 0x020001 0xbfef0000 0x000001bd 0x1bdbfef 0xbfef0040 R E 0xbdbfef
<unknown>: bfe 0x0000bd 0x00000007 0x00000004 0x00004 0x00164 R 0x400164
<unknown>: 20 0x000020 0x00000004 0x00000004 0x00004 0x1bdbfef 0x4001bd
<unknown>: 1bd 0x240040 0x00240000 0x00040000 0x40000 0x00000 0
There is no dynamic section in this file.
There are no relocations in this file.
The decoding of unwind sections for machine type MIPS R3000 is not currently supported.
No version information found in this file.
As it's a project from a school dealing with reverse engineering, the elf file may be corrupted or not. I have no idea from what the problem could come from. You can download myelf file from this link. Thank you.
Anyone have encountered this kind of error or any suggestions ?