Skip to content

Feature/export llvm#904

Merged
serpilliere merged 4 commits intocea-sec:masterfrom
commial:feature/export-LLVM
Dec 20, 2018
Merged

Feature/export llvm#904
serpilliere merged 4 commits intocea-sec:masterfrom
commial:feature/export-LLVM

Conversation

@commial
Copy link
Contributor

@commial 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
w4kfu pushed a commit to w4kfu/miasm that referenced this pull request Jun 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants