about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorDan Liew <delcypher@gmail.com>2014-01-17 05:30:10 -0800
committerDan Liew <delcypher@gmail.com>2014-01-17 05:30:10 -0800
commitf626bdb1905c4d56fdcca04cd6ee84acb7597431 (patch)
tree2fc5cea5c20d653e5b50981ca764849394d81e23
parent8c03dfa5ea9fe5176cbb82b70a36ffa93c70b91c (diff)
parent2f6dafae68e88f6a16f6df42e0b212767e95aebe (diff)
downloadklee-f626bdb1905c4d56fdcca04cd6ee84acb7597431.tar.gz
Merge pull request #94 from MartinNowack/fix_assert_library_linking
Fix assert library linking
-rw-r--r--lib/Module/KModule.cpp3
-rw-r--r--lib/Module/ModuleUtil.cpp6
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/Module/KModule.cpp b/lib/Module/KModule.cpp
index 34e5f60c..2ecb14b8 100644
--- a/lib/Module/KModule.cpp
+++ b/lib/Module/KModule.cpp
@@ -182,7 +182,8 @@ static void injectStaticConstructorsAndDestructors(Module *m) {
   
   if (ctors || dtors) {
     Function *mainFn = m->getFunction("main");
-    assert(mainFn && "unable to find main function");
+    if (!mainFn)
+      klee_error("Could not find main() function.");
 
     if (ctors)
     CallInst::Create(getStubFunctionForCtorList(m, ctors, "klee.ctor_stub"),
diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp
index fcdfa35a..9ae72936 100644
--- a/lib/Module/ModuleUtil.cpp
+++ b/lib/Module/ModuleUtil.cpp
@@ -9,6 +9,8 @@
 
 #include "klee/Internal/Support/ModuleUtil.h"
 #include "klee/Config/Version.h"
+// FIXME: This does not belong here.
+#include "../Core/Common.h"
 
 #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
 #include "llvm/Bitcode/ReaderWriter.h"
@@ -55,7 +57,7 @@ module->getContext());
 
   if (Linker::LinkModules(module, new_mod, Linker::DestroySource, 
 &err_str)) {
-    assert(0 && "linked in library failed!");
+    klee_error("Linking library %s failed", libraryName.c_str());
   }
 
   return module;
@@ -66,7 +68,7 @@ module->getContext());
   bool native = false;
     
   if (linker.LinkInFile(libraryPath, native)) {
-    assert(0 && "linking in library failed!");
+    klee_error("Linking library %s failed", libraryName.c_str());
   }
     
   return linker.releaseModule();