7

I have a ELF file, which is a partial firmware of a navigation module(my BMW idrive CCC), I need to decompile the elf file.

I tried Reko Decompiler which said it does not support SH4 and Snowman plugin on IDA and but looks like it does not detect the SH4 architecture cause it brought some push and pop instruction in C code, which besides the fact that it is considered cheating for a decompiler!, SH4 architecture has register block that does not need push and pop while calling routines, it actually does not have such thing.

At the following picture, the floating window at right shows the correct assembly code, unassembelied out of my ELF file. at the center however you see some incorrect assembly that snowman derived from ELF file which is totaly different! comparing with the correct one. IDA

So the decompiler MUST support architecture. I need a good Decompiler that can support SH4 architecture and ELF files.

  • 3
    Writing decompilers is not easy. Be glad if you find any decompiler for SH, let alone a "reliable" one. BTW, what is an "ELF pe"? – Igor Skochinsky Mar 10 '17 at 23:49
  • Are you looking for a tool that translates CPU instructions to assembly (a disassembler) or a tool that reconstructs the source code of an executable binary (decompiler)? – julian Mar 11 '17 at 0:01
  • @SYS_V IDA disassembles my elf file, but I need its C source code, it has been written in C, I am sure cause I see function names strcmp,.... in it, I need a C decompiler – Iman Mar 11 '17 at 8:41
  • 1
    Hello @Zich; reko decompiler maintainer here. If you wish to request SH4 support in reko, just add an issue here (github.com/uxmal/reko/issues). It takes me about 2 weeks to complete basic support for a new architecture in Reko. It helps if you can supply a sample ELF file for that architecture. – John Källén May 12 '17 at 21:12
  • 1
    Well, I went ahead and implemented partial support for SH4 anyway :) It's there in Reko should you wish to test it. – John Källén Sep 28 '18 at 9:46
-2

One of the most complete decompilers i use for pretty much everything ;) is the Radare2. Very agile, with a browser-based GUI (which you have to install extra :( ), supports python scripting and it decompiles almost everything!

| improve this answer | |
  • 2
    does it actually decompile SH, or just disassembles it? Please post some screenshots if it does. – Igor Skochinsky Mar 14 '17 at 10:25
  • If its an .elf there wont be any problem. I haven't tried SH4 based binaries myself, but there is an unofficial package for that packages.debian.org/sid/sh4/radare2/download – Chris Tsiakoulas Mar 14 '17 at 13:11
  • that just looks like r2 compiled for sh4. – Igor Skochinsky Mar 14 '17 at 13:14
  • Im on the go, i haven't checked thoroughtly... 😐 but give it a try... i once decompiled a .bin with firmware from an e-cigarrete without knowing anything about its microcontroller. Radare2 is very good with multiple hardware architectures. – Chris Tsiakoulas Mar 14 '17 at 13:17
  • 2
    @ChrisTsiakoulas it does not support SH4 see supported architectures here : radare.org/r/cmp.html – Iman Apr 6 '17 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.