From 7ad366f363d23b0aea788fca69349e50180f5f78 Mon Sep 17 00:00:00 2001 From: Lukas Wölfer Date: Sat, 4 Aug 2018 23:14:50 +0200 Subject: Added libcxx flag --- tools/klee/main.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tools') 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 + 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. -- cgit 1.4.1