about summary refs log tree commit diff homepage
path: root/tools
diff options
context:
space:
mode:
authorLukas Wölfer <lukas.woelfer@rwth-aachen.de>2018-08-04 23:14:50 +0200
committerCristian Cadar <c.cadar@imperial.ac.uk>2019-03-17 15:43:21 +0000
commit7ad366f363d23b0aea788fca69349e50180f5f78 (patch)
treeb24cee8cae488fc841d2e1ebfcaba069779b1f87 /tools
parent3b6f5e52d0cec5e8018c590c9feccb39bb03206c (diff)
downloadklee-7ad366f363d23b0aea788fca69349e50180f5f78.tar.gz
Added libcxx flag
Diffstat (limited to 'tools')
-rw-r--r--tools/klee/main.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp
index 9219134c..4e04dacc 100644
--- a/tools/klee/main.cpp
+++ b/tools/klee/main.cpp
@@ -287,6 +287,11 @@ namespace {
            cl::desc("Use a watchdog process to enforce --max-time."),
            cl::init(0),
            cl::cat(TerminationCat));
+
+  cl::opt<bool>
+  UseLibcxx("use-libcxx",
+           cl::desc("Link the llvm libc++ library into the bitcode"),
+           cl::init(0));
 }
 
 namespace klee {
@@ -1262,6 +1267,20 @@ int main(int argc, char **argv, char **envp) {
     preparePOSIX(loadedModules, libcPrefix);
   }
 
+  if (UseLibcxx) {
+#ifndef SUPPORT_KLEE_LIBCXX
+    klee_error("Klee was not compiled with libcxx support");
+#else
+    SmallString<128> LibcxxBC(Opts.LibraryDir);
+    llvm::sys::path::append(LibcxxBC, KLEE_LIBCXX_BC_NAME);
+    if (!klee::loadFile(LibcxxBC.c_str(), mainModule->getContext(), loadedModules,
+                        errorMsg))
+      klee_error("error loading free standing support '%s': %s",
+                 LibcxxBC.c_str(), errorMsg.c_str());
+    klee_message("NOTE: Using libcxx : %s", LibcxxBC.c_str());
+#endif
+  }
+
   switch (Libc) {
   case LibcType::KleeLibc: {
     // FIXME: Find a reasonable solution for this.