-
Notifications
You must be signed in to change notification settings - Fork 12
Compiling and linking files for instTrace pass
This guide assumes you have the following files
-
main.ll <- this is the entire c program to be tested, compiled and linked into one llvm IR bytecode file with llvm-gcc
-
instTraceLib.c <- The instTrace library file, as distributed by LLFI
To Run LLFI instTrace
-
Compile instTraceLib.c into an LLVM IR file with the following command "llvm-gcc instTraceLib.c -S -emit-llvm -o iTLib.ll"
-
Run the LLFI indexing pass on main.ll with "opt -load {Path to LLVM Lib}/LLFI.so -genllfiindexpass -S < main.ll > main.indexed.ll
-
Run the LLFI instTrace pass with "opt -load {Path to LLVM Lib}/LLFI.so -instTrace -S -tout goldenTrace < main.indexed.ll > main.traced.ll
-
Link main.traced.ll and the instTrace library with "llvm-link main.traced.ll iTLib.ll -S > main.linked.ll
-
Run the final program "lli main.linked.ll"
-
Examine instruction traces "cat goldenTrace"