9

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.

8
  • 4
    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, 2017 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, 2017 at 0:01
  • 1
    "PE" most commonly refers to the Microsoft Windows COFF/PE format, I would suggest you to edit that part to reduce confusion.
    – Igor Skochinsky
    Mar 11, 2017 at 8:51
  • 2
    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. May 12, 2017 at 21:12
  • 2
    Well, I went ahead and implemented partial support for SH4 anyway :) It's there in Reko should you wish to test it. Sep 28, 2018 at 9:46

2 Answers 2

2

As of the 9.1 release, Ghidra supports SH4.

-3

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!

6
  • 3
    does it actually decompile SH, or just disassembles it? Please post some screenshots if it does.
    – Igor Skochinsky
    Mar 14, 2017 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 Mar 14, 2017 at 13:11
  • that just looks like r2 compiled for sh4.
    – Igor Skochinsky
    Mar 14, 2017 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. Mar 14, 2017 at 13:17
  • 2
    @ChrisTsiakoulas it does not support SH4 see supported architectures here : radare.org/r/cmp.html
    – Iman Nia
    Apr 6, 2017 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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