about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorDan Liew <delcypher@gmail.com>2013-11-05 14:13:11 -0800
committerDan Liew <delcypher@gmail.com>2013-11-05 14:13:11 -0800
commitdaa26b1240e1f17854040975f220b1d62430a8e7 (patch)
treec41acf9630c464b29a8ed8ea4946499296f45715
parenta8dbdafd32483da1f2aff3852a405c2cef9753f9 (diff)
parent23225879b4e36c7926bc86dc22b4a6690fd0df4e (diff)
downloadklee-daa26b1240e1f17854040975f220b1d62430a8e7.tar.gz
Merge pull request #63 from delcypher/nouclibc
Exit if using --libc=uclibc and KLEE was not configured with uclibc
-rw-r--r--tools/klee/main.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp
index 922f8bb5..769be28e 100644
--- a/tools/klee/main.cpp
+++ b/tools/klee/main.cpp
@@ -30,6 +30,7 @@
 #include "llvm/Instructions.h"
 #if LLVM_VERSION_CODE >= LLVM_VERSION(2, 7)
 #include "llvm/LLVMContext.h"
+#include "llvm/Support/FileSystem.h"
 #endif
 #endif
 #if LLVM_VERSION_CODE < LLVM_VERSION(2, 7)
@@ -1013,6 +1014,12 @@ static void replaceOrRenameFunction(llvm::Module *module,
 }
 
 static llvm::Module *linkWithUclibc(llvm::Module *mainModule) {
+  // Ensure that KLEE_UCLIBC exists
+  bool uclibcRootExists=false;
+  llvm::sys::fs::is_directory(KLEE_UCLIBC, uclibcRootExists);
+  if (!uclibcRootExists)
+    klee_error("Cannot link with uclibc. KLEE_UCLIBC (\"" KLEE_UCLIBC "\") is not a directory.");
+
   Function *f;
   // force import of __uClibc_main
   mainModule->getOrInsertFunction("__uClibc_main",