diff options
author | Martin Nowack <m.nowack@imperial.ac.uk> | 2020-09-24 21:17:40 +0100 |
---|---|---|
committer | Cristian Cadar <c.cadar@imperial.ac.uk> | 2020-09-30 16:34:47 +0100 |
commit | 2fad33172fc5e7f5e03f7b7e4c753f7b2330bc0f (patch) | |
tree | b7aae9b896b39c3f964b1d9ce4aa84c376aaa98d /scripts | |
parent | a434c1ede97a763f3c48555a4925d8f7e1619ce1 (diff) | |
download | klee-2fad33172fc5e7f5e03f7b7e4c753f7b2330bc0f.tar.gz |
Reduce compile time and size for LLVM build
* Just target x86 as architecture * do not build tests for clang * use optimized tablegen * only build required tools and libraries that are needed by KLEE
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/build/p-llvm.inc | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/scripts/build/p-llvm.inc b/scripts/build/p-llvm.inc index 6ab18531..a97b8676 100644 --- a/scripts/build/p-llvm.inc +++ b/scripts/build/p-llvm.inc @@ -130,9 +130,11 @@ build_llvm() { mkdir -p "${SANITIZER_LLVM_UNINSTRUMENTED}" cd "${SANITIZER_LLVM_UNINSTRUMENTED}" cmake -GNinja -DCMAKE_BUILD_TYPE=Release \ + "-DLLVM_OPTIMIZED_TABLEGEN=ON" \ "-DLLVM_ENABLE_PROJECTS=clang;compiler-rt;libcxx;libcxxabi" \ + "-DLLVM_TARGETS_TO_BUILD=X86" \ "${LLVM_SRC_BASE}/llvm" - ninja + ninja compiler-rt cxx cxxabi clang || return 1 # Build instrumented libc/libc++ mkdir -p "${SANITIZER_LLVM_LIBCXX}" @@ -142,8 +144,10 @@ build_llvm() { -DLLVM_USE_SANITIZER=MemoryWithOrigins \ "${SANITIZER_CMAKE_C_COMPILER[@]}" \ "${SANITIZER_CMAKE_CXX_COMPILER[@]}" \ + "-DLLVM_OPTIMIZED_TABLEGEN=ON" \ + "-DLLVM_TARGETS_TO_BUILD=X86" \ "${LLVM_SRC_BASE}/llvm" - ninja cxx cxxabi + ninja compiler-rt cxx cxxabi|| return 1 # Build instrumented clang mkdir -p "${LLVM_BUILD}" @@ -163,9 +167,12 @@ build_llvm() { -DLLVM_ENABLE_LIBCXX=ON \ -DCMAKE_EXE_LINKER_FLAGS="${LD_F}" \ -DCMAKE_INSTALL_PREFIX="${LLVM_INSTALL}" \ + -DBUILD_SHARED_LIBS=ON \ + -DLLVM_OPTIMIZED_TABLEGEN=ON \ + -DLLVM_TARGETS_TO_BUILD=X86 \ "${LLVM_SRC_BASE}/llvm" # Build clang as a dependency and install all needed packages - ninja clang + ninja clang || return 1 return 0 fi @@ -176,13 +183,19 @@ build_llvm() { # Skip building if already finished [[ -e "${LLVM_BUILD}/.build_finished" ]] && return 0 - # Configure LLVM CONFIG=( "-DCMAKE_INSTALL_PREFIX=${LLVM_INSTALL}" "-DLLVM_BUILD_LLVM_DYLIB=TRUE" - "-DLLVM_ENABLE_PROJECTS=clang;compiler-rt;libcxx;libcxxabi" ) + + # Select components to build + if [[ ${LLVM_VERSION_SHORT} -ge 60 ]]; then + CONFIG+=("-DLLVM_ENABLE_PROJECTS=clang;compiler-rt;libcxx;libcxxabi") + else + CONFIG+=("-DLLVM_ENABLE_PROJECTS=clang;compiler-rt") + fi + # cmake build if [[ "${enable_optimized}" == "1" && "${enable_debug}" != "1" ]]; then CONFIG+=("-DCMAKE_BUILD_TYPE=Release") @@ -216,9 +229,11 @@ build_llvm() { CONFIG+=( "-DLLVM_INCLUDE_EXAMPLES=OFF" # "-DLLVM_INCLUDE_TESTS=OFF" -# "-DCLANG_INCLUDE_TESTS=OFF" + "-DCLANG_INCLUDE_TESTS=OFF" "-DLLVM_INCLUDE_BENCHMARKS=OFF" "-DBUILD_SHARED_LIBS=ON" + "-DLLVM_OPTIMIZED_TABLEGEN=ON" + "-DLLVM_TARGETS_TO_BUILD=X86" ) local variables=("") |