Before you use NIONKA-LLVM

  1. Obtain LLVM 2.6. Current version of NIONKA-LLVM is based on LLVM 2.6. Please make sure that you download the correct version and do not conflict with other versions of LLVM on your machine.

    Visit and download following packages:
    - LLVM-GCC 4.2 Front End for LLVM 2.6 version
    - LLVM 2.6 source code

    Build LLVM source code.

  2. Create a customized pass directory for our analysis. I suggest you to put our LLVM pass source code directory in "to-llvm-dir/lib/Transforms/" directory and add our new directory into Makefile file under this directory.
  3. Build our customized Ehj pass. If succeed, a library file start with LLVMEhj will appear on directory "to-llvm-dir/Release/lib/" or "to-llvm-dir/Debug/lib/" depends on what build option you choose for LLVM.

Use NIONKA-LLVM to instrument your code

  1. Use LLVM-GCC Front End to build your code into bytecode and link your code into a single bytecode file. Assume the file is named "code.bc".

  2. Use opt tool of LLVM to instrument code.bc

    $ opt -load "to-llvm-dir/Release/lib/" -ehj code.bc > instrumented.bc

    This will create a instrumented bytecode file "instrumented.bc".
  3. Link instrumented code with our Ehj library bytecode file "ehjlib.bc".

    $ llvm-link instrumented.bc ehjlib.bc -o linked.bc
  4. Compile assembly file from LLVM bytecode and use gcc to build executable file.

    $ llc linked.bc -o linked.s
    $ gcc -s linked.s -o a.out

    Now "a.out" is an executable instrumented file.

If the outputs in Step 4 and Step 5 are correct then you have a successfully installed NIONKA.

How to use NIONKA

Set up configure file in your working directory. Create a "branchFile.txt" file and put a basic block ID you want to flip. You can find the map from BB ID to BB name in output of Step 1. We also allow you to create a list of BB ID as stopping criterion for hijacked execution. Once the execution reaches thess BBs, the execution will be terminated.

Run the executable file generated in previous steps with inputs.