[LLVMdev] how to transform elf binary to llvm IR?
Joshua Cranmer 🐧
pidgeot18 at gmail.com
Sat Jul 18 19:23:33 PDT 2015
On 7/17/2015 2:09 AM, 慕冬亮 wrote:
> I want to transform elf binary to llvm IR, and do some instrumentation
> based on llvm.
> Is there any tool which can do the transformation?
It sounds like what you want to do is some form of binary translation,
and, quite frankly, LLVM is going to be a poor choice. LLVM is designed
to be a compiler IR, and its optimizations rely on source-level hinting
information that is irrevocably lost when converted to machine code.
While there do exist several projects that can do some conversion from
machine code to IR (Dagger, Fracture, MCSema), none of them are
sufficiently robust (to my knowledge). In comparison to projects whose
raison d'être is binary translation (e.g., Valgrind, Pin), you're not
going to see sufficient value-add in using LLVM to outweigh the fact
that you're using a very non-robust solution.
If you really want to use LLVM, I'd advise using clang to compile the
C/C++ code and do instrumentation passes within the clang compilation
process. I would not advise trying to do instrumentation via decompiling
binaries to LLVM IR.
--
Joshua Cranmer
Thunderbird and DXR developer
Source code archæologist
More information about the llvm-dev
mailing list