Jay Taylor's notes

back to listing index

repzret/dagger: Binary Translator to LLVM IR

[web search]
Original source (github.com)
Tags: decompilation llvm llvm-ir github.com
Clipped on: 2020-02-07

Skip to content
Image (Asset 1/5) alt= You have unread notifications
Binary Translator to LLVM IR
LLVM C++ Assembly Mirah C Python Other
Branch: master
New pull request
Clone or download
Pull request Compare This branch is even with ahmedbougacha:master.
Image (Asset 3/5) alt= bindings [Go] Subtypes function 3 years ago cmake Merge remote-tracking branch 'upstream/master' 3 years ago docs Merge remote-tracking branch 'upstream/master' 3 years ago examples [ORC] Switch the object layer API from addObjectSet to addObject (sin… 3 years ago include [DC] Update predicate list for addition of X86 masked gather. 3 years ago lib Merge remote-tracking branch 'upstream/master' 3 years ago projects Add temporary workaround to allow in-tree libc++ builds on Windows 3 years ago resources In MSVC builds embed a VERSIONINFO resource in our exe and DLL files. 5 years ago runtimes [CMake][runtimes] Add install target for runtimes builtins 3 years ago test Merge remote-tracking branch 'upstream/master' 3 years ago tools [DC][DYN] Update dyncore for upstream changes. 3 years ago unittests Merge remote-tracking branch 'upstream/master' 3 years ago utils Merge remote-tracking branch 'upstream/master' 3 years ago .arcconfig project_id is from another era in phabricator land and does not provi… 3 years ago .clang-format Test commit. 6 years ago .clang-tidy .clang-tidy: correct style name is 'camelBack' not 'lowerCase'. 3 years ago .gitignore gitignore: Ignore .vs folder (VS2017 config files) 3 years ago CMakeLists.txt Merge remote-tracking branch 'upstream/master' 3 years ago CODE_OWNERS.TXT CODE_OWNERS: Take code ownership of instruction scheduling. 3 years ago CREDITS.TXT update of the url 3 years ago LICENSE.TXT Bump year to 2017 in LICENSE.txt 3 years ago LLVMBuild.txt Remove the very substantial, largely unmaintained legacy PGO 6 years ago README.md fix building (ahmedbougacha#20ahmedbougacha#20, fix building) 2 years ago README.txt Test commit. Added a blank line. 3 years ago RELEASE_TESTERS.TXT Update the release tester for MIPS. NFC. 3 years ago configure Remove autoconf support 4 years ago llvm.spec.in [Sparc] Implement i64 load/store support for 32-bit sparc. 5 years ago

README.md

Dagger

Image (Asset 4/5) alt=Building

As an LLVM fork, Dagger is built the same way; assuming you have a reasonably recent toolchain and CMake, just do:

  $ cd dagger
  $ mkdir build
  $ cd build
  $ cmake ..
  $ make

More information on the llvm.org Getting Started and CMake pages.

Usage

While Dagger is intended to be usable as a library, it does come with tools:

Static Binary Translation to IR: llvm-dec

llvm-dec takes in an object file and produces IR.

  $ ./bin/llvm-dec ./a.out

Dynamic Binary Translation: DYN (OS X-only)

DYN is an OS X-only dylib that is intended to be preloaded so that it can hijack program execution:

  $ echo "int main() { return 42; }" | clang -x c -
  $ DYLD_INSERT_LIBRARIES=./lib/libDYN.dylib ./a.out
  $ echo $?
 42

This will "execute" a.out by translating all of its code to LLVM IR, JITting that, and finally executing it.

The DCDYN_OPTIONS environment variable can be used to pass command-line options. For instance, if you're really brave, you can try:

 $ DCDYN_OPTIONS="-print-after-all" DYLD_INSERT_LIBRARIES=build/lib/libDYN.dylib ./a.out

which will print tons of LLVM debug output.

Features

X86 is the main currently supported target. There is ongoing work on adding AArch64 support.

The Mach-O object file format is the best supported. Basic ELF is also supported. However, except for DYN, there is always a generic fallback, so YMMV with other formats.

Found 4 out of 4 items