Binary Translator to LLVM IR
LLVM C++ Assembly Mirah C Python Other
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bindings [Go] Subtypes function Jun 8, 2017
cmake Merge remote-tracking branch 'upstream/master' Jun 23, 2017
docs Merge remote-tracking branch 'upstream/master' Jun 23, 2017
examples [ORC] Switch the object layer API from addObjectSet to addObject (sin… Jun 22, 2017
include [DC] Update predicate list for addition of X86 masked gather. Jun 23, 2017
lib Merge remote-tracking branch 'upstream/master' Jun 23, 2017
projects Add temporary workaround to allow in-tree libc++ builds on Windows May 11, 2017
resources In MSVC builds embed a VERSIONINFO resource in our exe and DLL files. Jun 12, 2015
runtimes [CMake][runtimes] Add install target for runtimes builtins Jun 2, 2017
test Merge remote-tracking branch 'upstream/master' Jun 23, 2017
tools [DC][DYN] Update dyncore for upstream changes. Jun 23, 2017
unittests Merge remote-tracking branch 'upstream/master' Jun 23, 2017
utils Merge remote-tracking branch 'upstream/master' Jun 23, 2017
.arcconfig project_id is from another era in phabricator land and does not provi… Sep 27, 2016
.clang-format Test commit. Mar 2, 2014
.clang-tidy .clang-tidy: correct style name is 'camelBack' not 'lowerCase'. Sep 13, 2016
.gitignore gitignore: Ignore .vs folder (VS2017 config files) Apr 8, 2017
CMakeLists.txt Merge remote-tracking branch 'upstream/master' Jun 23, 2017
CODE_OWNERS.TXT CODE_OWNERS: Take code ownership of instruction scheduling. Mar 10, 2017
CREDITS.TXT update of the url May 14, 2017
LICENSE.TXT Bump year to 2017 in LICENSE.txt Jan 12, 2017
LLVMBuild.txt Remove the very substantial, largely unmaintained legacy PGO Oct 2, 2013
README.md fix building (#20) Dec 2, 2017
README.txt Test commit. Added a blank line. Mar 6, 2017
RELEASE_TESTERS.TXT Update the release tester for MIPS. NFC. Jan 17, 2017
configure Remove autoconf support Jan 26, 2016
llvm.spec.in [Sparc] Implement i64 load/store support for 32-bit sparc. Aug 10, 2015

README.md

Dagger

Build Status

Dagger is a binary translator to LLVM IR, with the goal of being as native as possible to the LLVM infrastructure.

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.