decomp.org/decomp/cmd/ll2go

Components of a decompilation pipeline.


Keywords
binary-analysis, compositional-decompilation, decompilation, decompilation-pipeline, decompiler, go, golang, llvm, llvm-ir, reverse-engineering
License
Unlicense
Install
go get decomp.org/decomp/cmd/ll2go

Documentation

The decomp.org project

The aim of this project is to implement a decompilation pipeline composed of independent components interacting through well-defined interfaces, as further described in the design documents of the project.

From a high-level perspective, the components of the decompilation pipeline are conceptually grouped into three modules. Firstly, the front-end translates a source language (e.g. x86 assembly) into LLVM IR; a platform-independent low-level intermediate representation. Secondly, the middle-end structures the LLVM IR by identifying high-level control flow primitives (e.g. pre-test loops, 2-way conditionals). Lastly, the back-end translates the structured LLVM IR into a high-level target programming language (e.g. Go).

The following poster summarizes the current capabilities of the decompilation pipeline, using a composition of independent components to translate LLVM IR to Go.

Poster: Compositional Decompilation

Front-end

Translate machine code (e.g. x86 assembly) to LLVM IR.

Third-party front-end components.

Middle-end

Perform control flow analysis on the LLVM IR to identify high-level control flow primitives (e.g. pre-test loops).

ll2dot

https://godoc.org/decomp.org/decomp/cmd/ll2dot

Control flow graph generation tool.

Generate control flow graphs from LLVM IR assembly files (e.g. *.ll -> *.dot)

restructure

https://godoc.org/decomp.org/decomp/cmd/restructure

Control flow recovery tool.

Recover control flow primitives from control flow graphs (e.g. *.dot -> *.json)

Back-end

Translate structured LLVM IR to a high-level target language (e.g. Go).

ll2go

https://godoc.org/decomp.org/decomp/cmd/ll2go

Go code generation tool.

Decompile LLVM IR assembly files to Go source code (e.g. *.ll -> *.go)

go-post

https://godoc.org/decomp.org/decomp/cmd/go-post

Go post-processing tool.

Post-process Go source code to make it more idiomatic

Public domain

The source code and any original content of this repository is hereby released into the public domain.