diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/klee/main.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp index d94cdc76..7d938ab2 100644 --- a/tools/klee/main.cpp +++ b/tools/klee/main.cpp @@ -187,6 +187,10 @@ namespace { cl::init(false), cl::cat(LinkCat)); + cl::opt<bool> WithUBSanRuntime("ubsan-runtime", + cl::desc("Link with UBSan runtime."), + cl::init(false), cl::cat(LinkCat)); + cl::opt<std::string> RuntimeBuild( "runtime-build", cl::desc("Link with versions of the runtime library that were built with " @@ -794,10 +798,6 @@ static const char *modelledExternals[] = { "_Znwj", "_Znam", "_Znwm", - "__ubsan_handle_add_overflow", - "__ubsan_handle_sub_overflow", - "__ubsan_handle_mul_overflow", - "__ubsan_handle_divrem_overflow", }; // Symbols we aren't going to warn about @@ -1265,6 +1265,15 @@ int main(int argc, char **argv, char **envp) { preparePOSIX(loadedModules, libcPrefix); } + if (WithUBSanRuntime) { + SmallString<128> Path(Opts.LibraryDir); + llvm::sys::path::append(Path, "libkleeUBSan" + opt_suffix + ".bca"); + if (!klee::loadFile(Path.c_str(), mainModule->getContext(), loadedModules, + errorMsg)) + klee_error("error loading UBSan support '%s': %s", Path.c_str(), + errorMsg.c_str()); + } + if (Libcxx) { #ifndef SUPPORT_KLEE_LIBCXX klee_error("KLEE was not compiled with libc++ support"); |