draperlaboratory/fracture

How to use the decompiled IR

Closed this issue · 1 comments

I'm trying to use the example LLVM IR given in the install.md:

$ cat testcode.ll
define void @main() {
entry:
  %CPSR = alloca i32
  %CPSR1 = load i32* @CPSR
  store i32 %CPSR1,
...

However, when I try to compile that back into native code, llc complains as follows:

$ llc-3.5 testcode.ll 
llc-3.5: testcode.ll:53:31: error: use of undefined metadata '!4'
  %SP10 = load i32* %SP, !dbg !4

Is the IR generated supposed to be chained into further tools (e.g. llc in this case)?

The metadata is actually traceback to the address offset that generated the code. Try save test.ll to get all of the metadata.

ALSO: Please note that while binary rewriting is on the roadmap, it is not supposed to work at this time. Most likely it will reference memory from the binary's data section and, since we do not pull that out, it will fail to compile.