New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/export llvm #904

Merged
merged 4 commits into from Dec 20, 2018

Conversation

Projects
None yet
2 participants
@commial
Copy link
Member

commial commented Dec 20, 2018

Add basics to export an IRCFG as LLVM IR.
Because several tools are working on LLVM IR, but each with specific format, the user have to make its own choices.

For instance:

  • for use with RetDec, it is better to have all registers always represented as globals, in lower case, IRDst replaced by @_asm_program_counter, etc.
  • for better LLVM transformation, it is nice to represent stack as an array, and represent operation on ESP with getelementptr operation
  • McSema made the choice to represent registers as a structure in function argument, with setup and exit functions. It might be better suited for recompilation (for instance, running an ARM code on a x86 machine)
  • for better removal and lighter final version, one can add ABI information, such as clobber registers (avoid keeping copy of flags, etc.), link from LLVM function arguments to corresponding registers representation, returning the value in EAX instead of void, etc.

It may also be better to perform some of them with LLVM passes.

It would be great to add in a future the LLVM -> Expr, to enjoy going back and forth with LLVM. As Miasm is now supporting SSA, it doesn't seems to hard to achieve.

@serpilliere serpilliere merged commit 011e1e2 into cea-sec:master Dec 20, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment