about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt22
-rw-r--r--include/klee/Config/config.h.cmin3
-rw-r--r--lib/Core/SpecialFunctionHandler.cpp2
-rw-r--r--runtime/CMakeLists.txt6
-rw-r--r--runtime/Makefile.cmake.bitcode2
-rw-r--r--runtime/Makefile.cmake.bitcode.config.in2
-rw-r--r--scripts/build/p-klee.inc2
-rw-r--r--test/CXX/symex/libc++/can_catch_test.cpp1
-rw-r--r--test/CXX/symex/libc++/catch_recover.cpp1
-rw-r--r--test/CXX/symex/libc++/catch_with_adjusted_exception_pointer.cpp1
-rw-r--r--test/CXX/symex/libc++/exception.cpp1
-rw-r--r--test/CXX/symex/libc++/exception_inheritance.cpp1
-rw-r--r--test/CXX/symex/libc++/general_catch.cpp1
-rw-r--r--test/CXX/symex/libc++/landingpad.cpp1
-rw-r--r--test/CXX/symex/libc++/multi_throw.cpp1
-rw-r--r--test/CXX/symex/libc++/multi_unwind.cpp1
-rw-r--r--test/CXX/symex/libc++/nested.cpp1
-rw-r--r--test/CXX/symex/libc++/nested_fail.cpp1
-rw-r--r--test/CXX/symex/libc++/rethrow.cpp1
-rw-r--r--test/CXX/symex/libc++/simple_exception.cpp1
-rw-r--r--test/CXX/symex/libc++/simple_exception_fail.cpp1
-rw-r--r--test/CXX/symex/libc++/symbolic_exception.cpp1
-rw-r--r--test/CXX/symex/libc++/throw_specifiers.cpp1
-rw-r--r--test/CXX/symex/libc++/throwing_exception_destructor.cpp1
-rw-r--r--test/CXX/symex/libc++/uncaught_exception.cpp1
-rw-r--r--test/lit.cfg4
-rw-r--r--test/lit.site.cfg.in1
-rw-r--r--tools/klee/main.cpp4
28 files changed, 58 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 916c2d74..1fa4fcc6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -705,6 +705,28 @@ else()
 endif()
 
 ################################################################################
+# KLEE Exception Handling Support for C++
+################################################################################
+option(ENABLE_KLEE_EH_CXX "Enable support for C++ Exceptions" OFF)
+if (ENABLE_KLEE_EH_CXX)
+  if (NOT ENABLE_KLEE_LIBCXX)
+    message(FATAL_ERROR "C++ Exception support requires klee-libcxx."
+      "Pass `-DENABLE_KLEE_LIBCXX=ON` to enable it.")
+  endif()
+
+  if (${LLVM_VERSION_MAJOR} GREATER 8 OR ${LLVM_VERSION_MAJOR} EQUAL 8)
+    set(SUPPORT_KLEE_EH_CXX 1) # For config.h
+    message(STATUS "Support for C++ Exceptions enabled")
+  else()
+    set(SUPPORT_KLEE_EH_CXX 0) # For config.h
+    message(STATUS "Support for C++ Exceptions (only available for LLVM >= 8.0.0) disabled")
+  endif()
+
+else()
+  set(SUPPORT_KLEE_EH_CXX 0) # For config.h
+endif()
+
+################################################################################
 # Sanitizer support
 ################################################################################
 message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
diff --git a/include/klee/Config/config.h.cmin b/include/klee/Config/config.h.cmin
index 4c25c075..00431117 100644
--- a/include/klee/Config/config.h.cmin
+++ b/include/klee/Config/config.h.cmin
@@ -92,6 +92,9 @@
 /* libcxx is supported */
 #cmakedefine SUPPORT_KLEE_LIBCXX @SUPPORT_KLEE_LIBCXX@
 
+/* exception handling for C++ is supported */
+#cmakedefine SUPPORT_KLEE_EH_CXX @SUPPORT_KLEE_EH_CXX@
+
 /* Configuration type of KLEE's runtime libraries */
 #define RUNTIME_CONFIGURATION "@KLEE_RUNTIME_BUILD_TYPE@"
 
diff --git a/lib/Core/SpecialFunctionHandler.cpp b/lib/Core/SpecialFunctionHandler.cpp
index a853d6ad..7144e235 100644
--- a/lib/Core/SpecialFunctionHandler.cpp
+++ b/lib/Core/SpecialFunctionHandler.cpp
@@ -477,7 +477,7 @@ void SpecialFunctionHandler::handleEhUnwindRaiseExceptionImpl(
   }
 
   if (state.unwindingInformation &&
-      isa<SearchPhaseUnwindingInformation>(state.unwindingInformation)) {
+      isa<SearchPhaseUnwindingInformation>(state.unwindingInformation.get())) {
     executor.terminateStateOnExecError(
         state,
         "Internal error: Unwinding restarted during an ongoing search phase");
diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt
index 8e7e7226..88a3faf8 100644
--- a/runtime/CMakeLists.txt
+++ b/runtime/CMakeLists.txt
@@ -32,7 +32,7 @@ else()
   set(BUILD_POSIX_RUNTIME 0)
 endif()
 
-if (ENABLE_KLEE_LIBCXX)
+if (ENABLE_KLEE_EH_CXX)
   set(BUILD_KLEE_EH_CXX 1)
 else()
   set(BUILD_KLEE_EH_CXX 0)
@@ -54,7 +54,7 @@ set(BITCODE_LIBRARIES "Intrinsic" "klee-libc" "FreeStanding")
 if (ENABLE_POSIX_RUNTIME)
   list(APPEND BITCODE_LIBRARIES "POSIX")
 endif()
-if (ENABLE_KLEE_LIBCXX)
+if (ENABLE_KLEE_EH_CXX)
   list(APPEND BITCODE_LIBRARIES "klee-eh-cxx")
 endif()
 foreach (bl ${BITCODE_LIBRARIES})
@@ -145,7 +145,7 @@ if (ENABLE_POSIX_RUNTIME)
     "${KLEE_RUNTIME_DIRECTORY}/libkleeRuntimePOSIX.bca")
 endif()
 
-if (ENABLE_KLEE_LIBCXX)
+if (ENABLE_KLEE_EH_CXX)
   list(APPEND RUNTIME_FILES_TO_INSTALL
     "${KLEE_RUNTIME_DIRECTORY}/libklee-eh-cxx.bca")
 endif()
diff --git a/runtime/Makefile.cmake.bitcode b/runtime/Makefile.cmake.bitcode
index 1dfdfde6..dd32161d 100644
--- a/runtime/Makefile.cmake.bitcode
+++ b/runtime/Makefile.cmake.bitcode
@@ -17,7 +17,7 @@ ifneq ($(ENABLE_POSIX_RUNTIME),0)
 	DIRS += POSIX
 endif
 
-ifneq ($(BUILD_KLEE_EH_CXX),0)
+ifneq ($(ENABLE_KLEE_EH_CXX),0)
 	DIRS += klee-eh-cxx
 endif
 
diff --git a/runtime/Makefile.cmake.bitcode.config.in b/runtime/Makefile.cmake.bitcode.config.in
index 99faa647..b3464a14 100644
--- a/runtime/Makefile.cmake.bitcode.config.in
+++ b/runtime/Makefile.cmake.bitcode.config.in
@@ -32,7 +32,7 @@ RUNTIME_CONFIG_STRING := @KLEE_RUNTIME_BUILD_TYPE@
 
 # Optional features
 ENABLE_POSIX_RUNTIME := @BUILD_POSIX_RUNTIME@
-BUILD_KLEE_EH_CXX := @BUILD_KLEE_EH_CXX@
+ENABLE_KLEE_EH_CXX := @BUILD_KLEE_EH_CXX@
 KLEE_LIBCXX_INCLUDE_DIR := @KLEE_LIBCXX_INCLUDE_DIR@
 KLEE_LIBCXXABI_SRC_DIR := @KLEE_LIBCXXABI_SRC_DIR@
 KLEE_INCLUDE_DIR := @CMAKE_SOURCE_DIR@/include
diff --git a/scripts/build/p-klee.inc b/scripts/build/p-klee.inc
index 9608fe89..34b73338 100644
--- a/scripts/build/p-klee.inc
+++ b/scripts/build/p-klee.inc
@@ -55,6 +55,8 @@ if [ "${USE_LIBCXX}" -eq 1 ]; then
     "-DKLEE_LIBCXX_INCLUDE_DIR=${LIBCXX_INSTALL}/include/c++/v1"
     "-DKLEE_LIBCXXABI_SRC_DIR=${LIBCXX_SRC}/libcxxabi"
   )
+  local LLVM_VERSION_MAJOR="${LLVM_VERSION/.*/}"
+  [[ "${LLVM_VERSION_MAJOR}" -ge 8 ]] && CMAKE_ARGUMENTS+=("-DENABLE_KLEE_EH_CXX=TRUE")
 else
   CMAKE_ARGUMENTS+=(
     "-DENABLE_KLEE_LIBCXX=FALSE"
diff --git a/test/CXX/symex/libc++/can_catch_test.cpp b/test/CXX/symex/libc++/can_catch_test.cpp
index 9d3a2d23..c70d14a2 100644
--- a/test/CXX/symex/libc++/can_catch_test.cpp
+++ b/test/CXX/symex/libc++/can_catch_test.cpp
@@ -1,5 +1,6 @@
 // REQUIRES: uclibc
 // REQUIRES: libcxx
+// REQUIRES: eh-cxx
 // RUN: %clangxx %s -emit-llvm %O0opt -std=c++11 -c -I "%libcxx_include" -g -nostdinc++ -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --exit-on-error --libcxx --libc=uclibc %t.bc 2>&1 | FileCheck %s
diff --git a/test/CXX/symex/libc++/catch_recover.cpp b/test/CXX/symex/libc++/catch_recover.cpp
index 44362b25..c77bea91 100644
--- a/test/CXX/symex/libc++/catch_recover.cpp
+++ b/test/CXX/symex/libc++/catch_recover.cpp
@@ -1,6 +1,7 @@
 // REQUIRES: not-msan
 // Disabling msan because it times out on CI
 // REQUIRES: libcxx
+// REQUIRES: eh-cxx
 // RUN: %clangxx %s -emit-llvm %O0opt -c -std=c++11 -I "%libcxx_include" -g -nostdinc++ -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --libc=uclibc --libcxx %t1.bc 2>&1 | FileCheck %s
diff --git a/test/CXX/symex/libc++/catch_with_adjusted_exception_pointer.cpp b/test/CXX/symex/libc++/catch_with_adjusted_exception_pointer.cpp
index bfb69be4..e3bf08ad 100644
--- a/test/CXX/symex/libc++/catch_with_adjusted_exception_pointer.cpp
+++ b/test/CXX/symex/libc++/catch_with_adjusted_exception_pointer.cpp
@@ -1,5 +1,6 @@
 // REQUIRES: uclibc
 // REQUIRES: libcxx
+// REQUIRES: eh-cxx
 // RUN: %clangxx %s -emit-llvm %O0opt -std=c++11 -c -I "%libcxx_include" -g -nostdinc++ -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --exit-on-error --libcxx --libc=uclibc %t.bc 2>&1 | FileCheck %s
diff --git a/test/CXX/symex/libc++/exception.cpp b/test/CXX/symex/libc++/exception.cpp
index b46d474e..4d6805f6 100644
--- a/test/CXX/symex/libc++/exception.cpp
+++ b/test/CXX/symex/libc++/exception.cpp
@@ -1,6 +1,7 @@
 // REQUIRES: not-msan
 // Disabling msan because it times out on CI
 // REQUIRES: libcxx
+// REQUIRES: eh-cxx
 // RUN: %clangxx %s -emit-llvm %O0opt -c -std=c++11 -I "%libcxx_include" -g -nostdinc++ -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --libc=uclibc --libcxx %t1.bc 2>&1 | FileCheck %s
diff --git a/test/CXX/symex/libc++/exception_inheritance.cpp b/test/CXX/symex/libc++/exception_inheritance.cpp
index 4e42fbb7..ca207eb4 100644
--- a/test/CXX/symex/libc++/exception_inheritance.cpp
+++ b/test/CXX/symex/libc++/exception_inheritance.cpp
@@ -1,5 +1,6 @@
 // REQUIRES: uclibc
 // REQUIRES: libcxx
+// REQUIRES: eh-cxx
 // RUN: %clangxx %s -emit-llvm %O0opt -std=c++11 -c -I "%libcxx_include" -g -nostdinc++ -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --exit-on-error --libcxx --libc=uclibc %t.bc 2>&1 | FileCheck %s
diff --git a/test/CXX/symex/libc++/general_catch.cpp b/test/CXX/symex/libc++/general_catch.cpp
index ee7f9983..c544f7a3 100644
--- a/test/CXX/symex/libc++/general_catch.cpp
+++ b/test/CXX/symex/libc++/general_catch.cpp
@@ -1,6 +1,7 @@
 // REQUIRES: not-msan
 // Disabling msan because it times out on CI
 // REQUIRES: libcxx
+// REQUIRES: eh-cxx
 // RUN: %clangxx %s -emit-llvm %O0opt -c -std=c++11 -I "%libcxx_include" -g -nostdinc++ -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --libc=uclibc --libcxx %t1.bc 2>&1 | FileCheck %s
diff --git a/test/CXX/symex/libc++/landingpad.cpp b/test/CXX/symex/libc++/landingpad.cpp
index 21e55536..13dd6bc4 100644
--- a/test/CXX/symex/libc++/landingpad.cpp
+++ b/test/CXX/symex/libc++/landingpad.cpp
@@ -3,6 +3,7 @@
 // Based on: https://gcc.gnu.org/wiki/Dwarf2EHNewbiesHowto
 // REQUIRES: uclibc
 // REQUIRES: libcxx
+// REQUIRES: eh-cxx
 // RUN: %clangxx %s -emit-llvm %O0opt -std=c++11 -c -I "%libcxx_include" -g -nostdinc++ -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --exit-on-error --libcxx --libc=uclibc  %t.bc | FileCheck %s
diff --git a/test/CXX/symex/libc++/multi_throw.cpp b/test/CXX/symex/libc++/multi_throw.cpp
index be07bc17..52e8d9b9 100644
--- a/test/CXX/symex/libc++/multi_throw.cpp
+++ b/test/CXX/symex/libc++/multi_throw.cpp
@@ -1,6 +1,7 @@
 // REQUIRES: not-msan
 // Disabling msan because it times out on CI
 // REQUIRES: libcxx
+// REQUIRES: eh-cxx
 // RUN: %clangxx %s -emit-llvm %O0opt -c -std=c++11 -I "%libcxx_include" -g -nostdinc++ -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --libc=uclibc --libcxx %t1.bc 2>&1 | FileCheck %s
diff --git a/test/CXX/symex/libc++/multi_unwind.cpp b/test/CXX/symex/libc++/multi_unwind.cpp
index 98bae1dc..cf29422c 100644
--- a/test/CXX/symex/libc++/multi_unwind.cpp
+++ b/test/CXX/symex/libc++/multi_unwind.cpp
@@ -1,6 +1,7 @@
 // REQUIRES: not-msan
 // Disabling msan because it times out on CI
 // REQUIRES: libcxx
+// REQUIRES: eh-cxx
 // RUN: %clangxx %s -emit-llvm %O0opt -c -std=c++11 -I "%libcxx_include" -g -nostdinc++ -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --libc=uclibc --libcxx %t1.bc 2>&1 | FileCheck %s
diff --git a/test/CXX/symex/libc++/nested.cpp b/test/CXX/symex/libc++/nested.cpp
index b85d6759..21222642 100644
--- a/test/CXX/symex/libc++/nested.cpp
+++ b/test/CXX/symex/libc++/nested.cpp
@@ -1,6 +1,7 @@
 // REQUIRES: not-msan
 // Disabling msan because it times out on CI
 // REQUIRES: libcxx
+// REQUIRES: eh-cxx
 // RUN: %clangxx %s -emit-llvm %O0opt -c -std=c++11 -I "%libcxx_include" -g -nostdinc++ -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --exit-on-error --libc=uclibc --libcxx %t1.bc 2>&1 | FileCheck %s
diff --git a/test/CXX/symex/libc++/nested_fail.cpp b/test/CXX/symex/libc++/nested_fail.cpp
index 919434f1..d0b8ca09 100644
--- a/test/CXX/symex/libc++/nested_fail.cpp
+++ b/test/CXX/symex/libc++/nested_fail.cpp
@@ -1,6 +1,7 @@
 // REQUIRES: not-msan
 // Disabling msan because it times out on CI
 // REQUIRES: libcxx
+// REQUIRES: eh-cxx
 // RUN: %clangxx %s -emit-llvm %O0opt -c -std=c++11 -I "%libcxx_include" -g -nostdinc++ -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --libc=uclibc --libcxx %t1.bc 2>&1 | FileCheck %s
diff --git a/test/CXX/symex/libc++/rethrow.cpp b/test/CXX/symex/libc++/rethrow.cpp
index d6a0954d..149fe693 100644
--- a/test/CXX/symex/libc++/rethrow.cpp
+++ b/test/CXX/symex/libc++/rethrow.cpp
@@ -1,5 +1,6 @@
 // REQUIRES: uclibc
 // REQUIRES: libcxx
+// REQUIRES: eh-cxx
 // RUN: %clangxx %s -emit-llvm %O0opt -std=c++11 -c -I "%libcxx_include" -g -nostdinc++ -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --exit-on-error --libcxx --libc=uclibc %t.bc 2>&1 | FileCheck %s
diff --git a/test/CXX/symex/libc++/simple_exception.cpp b/test/CXX/symex/libc++/simple_exception.cpp
index af002253..4d7d2c92 100644
--- a/test/CXX/symex/libc++/simple_exception.cpp
+++ b/test/CXX/symex/libc++/simple_exception.cpp
@@ -1,6 +1,7 @@
 // REQUIRES: not-msan
 // Disabling msan because it times out on CI
 // REQUIRES: libcxx
+// REQUIRES: eh-cxx
 // RUN: %clangxx %s -emit-llvm %O0opt -c -std=c++11 -I "%libcxx_include" -g -nostdinc++ -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --libc=uclibc --libcxx %t1.bc 2>&1 | FileCheck %s
diff --git a/test/CXX/symex/libc++/simple_exception_fail.cpp b/test/CXX/symex/libc++/simple_exception_fail.cpp
index d4a30b25..bda2cd33 100644
--- a/test/CXX/symex/libc++/simple_exception_fail.cpp
+++ b/test/CXX/symex/libc++/simple_exception_fail.cpp
@@ -1,6 +1,7 @@
 // REQUIRES: not-msan
 // Disabling msan because it times out on CI
 // REQUIRES: libcxx
+// REQUIRES: eh-cxx
 // RUN: %clangxx %s -emit-llvm %O0opt -c -std=c++11 -I "%libcxx_include" -g -nostdinc++ -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --libc=uclibc --libcxx %t1.bc 2>&1 | FileCheck %s
diff --git a/test/CXX/symex/libc++/symbolic_exception.cpp b/test/CXX/symex/libc++/symbolic_exception.cpp
index 49d432a8..3f29fa04 100644
--- a/test/CXX/symex/libc++/symbolic_exception.cpp
+++ b/test/CXX/symex/libc++/symbolic_exception.cpp
@@ -1,6 +1,7 @@
 // REQUIRES: not-msan
 // Disabling msan because it times out on CI
 // REQUIRES: libcxx
+// REQUIRES: eh-cxx
 // RUN: %clangxx %s -emit-llvm %O0opt -c -std=c++11 -I "%libcxx_include" -g -nostdinc++ -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --libc=uclibc --libcxx %t1.bc 2>&1 | FileCheck %s
diff --git a/test/CXX/symex/libc++/throw_specifiers.cpp b/test/CXX/symex/libc++/throw_specifiers.cpp
index 5a7955fb..96195cd4 100644
--- a/test/CXX/symex/libc++/throw_specifiers.cpp
+++ b/test/CXX/symex/libc++/throw_specifiers.cpp
@@ -2,6 +2,7 @@
 // throw specifications on functions
 // REQUIRES: uclibc
 // REQUIRES: libcxx
+// REQUIRES: eh-cxx
 // RUN: %clangxx %s -emit-llvm %O0opt -std=c++11 -c -I "%libcxx_include" -g -nostdinc++ -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --libcxx --libc=uclibc  %t.bc | FileCheck %s
diff --git a/test/CXX/symex/libc++/throwing_exception_destructor.cpp b/test/CXX/symex/libc++/throwing_exception_destructor.cpp
index d24a15b0..02d7cdb9 100644
--- a/test/CXX/symex/libc++/throwing_exception_destructor.cpp
+++ b/test/CXX/symex/libc++/throwing_exception_destructor.cpp
@@ -1,6 +1,7 @@
 // Testcase for proper handling of exception destructors that throw.
 // REQUIRES: uclibc
 // REQUIRES: libcxx
+// REQUIRES: eh-cxx
 // RUN: %clangxx %s -emit-llvm -O0 -std=c++11 -c -I "%libcxx_include" -g -nostdinc++ -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --libcxx --libc=uclibc --exit-on-error  %t.bc
diff --git a/test/CXX/symex/libc++/uncaught_exception.cpp b/test/CXX/symex/libc++/uncaught_exception.cpp
index 4e8f90f5..3cb54bc3 100644
--- a/test/CXX/symex/libc++/uncaught_exception.cpp
+++ b/test/CXX/symex/libc++/uncaught_exception.cpp
@@ -1,6 +1,7 @@
 // REQUIRES: not-msan
 // Disabling msan because it times out on CI
 // REQUIRES: libcxx
+// REQUIRES: eh-cxx
 // RUN: %clangxx %s -emit-llvm %O0opt -c -std=c++11 -I "%libcxx_include" -g -nostdinc++ -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --libc=uclibc --libcxx %t1.bc 2>&1 | FileCheck %s
diff --git a/test/lit.cfg b/test/lit.cfg
index c1003e70..1bfc16e9 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg
@@ -200,6 +200,10 @@ if config.enable_posix_runtime:
 if config.enable_libcxx:
   config.available_features.add('libcxx')
 
+# C++ Exception Handling feature
+if config.enable_eh_cxx:
+  config.available_features.add('eh-cxx')
+
 # Target operating system features
 supported_targets = ['linux', 'darwin', 'freebsd']
 for target in supported_targets:
diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in
index 99c82bb8..5f2415d6 100644
--- a/test/lit.site.cfg.in
+++ b/test/lit.site.cfg.in
@@ -32,6 +32,7 @@ if @LLVM_VERSION_MAJOR@ >= 5:
 config.enable_uclibc = True if @SUPPORT_KLEE_UCLIBC@ == 1 else False
 config.enable_posix_runtime = True if @ENABLE_POSIX_RUNTIME@ == 1 else False
 config.enable_libcxx = True if @SUPPORT_KLEE_LIBCXX@ == 1 else False
+config.enable_eh_cxx = True if @SUPPORT_KLEE_EH_CXX@ == 1 else False
 config.have_selinux = True if @HAVE_SELINUX@ == 1 else False
 config.enable_stp = True if @ENABLE_STP@ == 1 else False
 config.enable_z3 = True if @ENABLE_Z3@ == 1 else False
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp
index 61a9f164..44fa4cc5 100644
--- a/tools/klee/main.cpp
+++ b/tools/klee/main.cpp
@@ -1272,14 +1272,14 @@ int main(int argc, char **argv, char **envp) {
       klee_error("error loading libcxx '%s': %s", LibcxxBC.c_str(),
                  errorMsg.c_str());
     klee_message("NOTE: Using libcxx : %s", LibcxxBC.c_str());
-
+#ifdef SUPPORT_KLEE_EH_CXX
     SmallString<128> EhCxxPath(Opts.LibraryDir);
     llvm::sys::path::append(EhCxxPath, "libklee-eh-cxx.bca");
     if (!klee::loadFile(EhCxxPath.c_str(), mainModule->getContext(),
                         loadedModules, errorMsg))
       klee_error("error loading libklee-eh-cxx '%s': %s", EhCxxPath.c_str(),
                  errorMsg.c_str());
-
+#endif
 #endif
   }