Setup Guide (Autoconf) - SVF-tools/SVF GitHub Wiki
Build LLVM and Clang (if you have already done both, just skip it and jump to step 5)
-
Download LLVM-3.8.0, clang-3.8.0
-
Unzip the LLVM and Clang source files
tar xf llvm-3.8.0.tar.xz
tar xf cfe-3.8.0.tar.xz
mv cfe-3.8.0.src llvm-3.8.0.src/tools/clang
- Create your target build folder and make
mkdir llvm-3.8.0.obj
cd llvm-3.8.0.obj
../llvm-3.8.0.src/configure --enable-assertions
make -j8 (or make -j8 ENABLE_OPTIMIZED=0 for debug version)
- Add paths for LLVM and Clang
export LLVM_SRC=your_path_to_llvm-3.8.0.src
export LLVM_OBJ=your_path_to_llvm-3.8.0.obj
export PATH=$LLVM_OBJ/Release+Asserts/bin:$PATH
Build SVF
-
Download the SVF source code
-
Clean the previous build configuration files
rm -rf Makefile.common && rm -rf configure
- Change configure to point to your LLVM Path
vi autoconf/configure.ac
change value of LLVM_SRC_ROOT to $LLVM_SRC change value of LLVM_OBJ_ROOT to $LLVM_OBJ
cd autoconf
./AutoRegen.sh
input your LLVM_SRC_ROOT and LLVM_OBJ_ROOT following the command line
- Configure and make
Build the release version in the source root of SVF folder:
./configure && make
Build the debug version of SVF (debug version of LLVM is not required):
./configure && make ENABLE_OPTIMIZED=0
- Compile a single-file C program to a LLVM bitcode file or compile and link multiple C files using llvm-link. To compile a complicated real-world project you may wish to use LLVM gold plugin. See this guide to install it.
clang -c -emit-llvm -g example.c -o example.bc
clang -c -emit-llvm -g example1.c -o example1.bc
clang -c -emit-llvm -g example2.c -o example2.bc
llvm-link example1.bc example2.bc