GrammaTech / ddisasm

A fast and accurate disassembler
https://grammatech.github.io/ddisasm/
GNU Affero General Public License v3.0
647 stars 59 forks source link

add an ELF 32 support #2

Closed rocahe closed 3 years ago

rocahe commented 5 years ago

I just noticed that the ELF-reader only accepts ELF-64 binary. Could you please add an ELF 32 support? Thanks.

rocahe commented 5 years ago

BTW, does the current version only support X86_64 ELF binary? Is it possible to support ARM/MIPS binaries?

aeflores commented 5 years ago

You are right, ddisasm only supports ELF X86_64 binaries at the moment. Currently we do not have plans to extend to other ISAs or file formats. Our near-term priority is on maximizing the robustness and speed of the disassembler before we worry about generalization.

MatthiasJReisinger commented 4 years ago

hi :) even tough supporting other ISAs might not yet be planned, would it theoretically be feasible to extend it to ARM (also older versions, e.g. v6/v7) or would this require some fundamental adaptions? I just had a quick look at the code, but the approach per se does not seem to be architecture specific and the x64-specifics in the datalog rules already seem to be encapsulated in the src/datalog/x64 directory. adding another ISA would probably mean (at least) adding rules similar to those in the x64 directory, right? :)

aeflores commented 4 years ago

Hi @MatthiasJReisinger, you are right, the architecture-specific stuff is mostly encapsulated in scr/datalog/x64. This encapsulation is not perfect, but we are working to improve it. In fact, we are currently making some refactoring to facilitate incorporating other ISAs (x64 is still assumed in several places in the C++ code).

Once this refactoring is completed, we will merge https://github.com/binrats/ddisasm which adds some support for ARM8. This should make adding further ISAs much easier.

MatthiasJReisinger commented 4 years ago

ok, very cool and thanks for the answer! :) is there already a plan when this refactoring will be at a point that the ARM support could be merged?

kwarrick commented 4 years ago

@MatthiasJReisinger If all goes well, the refactor should actually happen pretty soon. Hopefully by the end of the week or early next week. 🤞

MatthiasJReisinger commented 4 years ago

hi again :) first of all, thx for merging the arm64 support! Even though it is not yet a feature that is part of a released version, I would be interested in how "stable" the arm support is currently supposed to be or when it is expected to reach a level of stability that is comparable to the x64 support (in case that can be estimated at the moment). I was playing with a few basic programs (e.g. simple hello world written in C) and received error messages - for example, some that are issued by the buildOperand function in DatalogUtils.cpp ("unsupported: MRS", "unsupported: FP", etc.). thx in advance! :)

aeflores commented 4 years ago

Hi @MatthiasJReisinger, the ARM64 support is very preliminary (i.e. not stable at all). We are still doing some refactoring to have better modularity for different architectures. Once that is done, we will likely go back to improving ARM64 support, but it might take a while... I don't think I can give you an estimate right now.

MatthiasJReisinger commented 4 years ago

ok, no problem, thanks for the update though! :)

aeflores commented 3 years ago

As of now, ddisasm has some initial support for X86_32 ELF binaries.