about summary refs log tree commit diff homepage
path: root/tools
diff options
context:
space:
mode:
authorMartinNowack <martin.nowack@gmail.com>2016-02-26 22:36:28 +0100
committerMartinNowack <martin.nowack@gmail.com>2016-02-26 22:36:28 +0100
commit29fc0df056dcdc7cacc1627ba80d12da6d3ef493 (patch)
treebd9c2a0a225ebdd3a475158c4004b8a51f78f030 /tools
parentf76b6c5fe0ce8920ee6edb13802f857dae49e785 (diff)
parent66f53aac10962db150aec07b96f3b0a756eef28b (diff)
downloadklee-29fc0df056dcdc7cacc1627ba80d12da6d3ef493.tar.gz
Merge pull request #346 from omeranson/libraries_squashed
Added support to load libraries from command line
Diffstat (limited to 'tools')
-rw-r--r--tools/klee/main.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp
index 665cc842..0dfa4399 100644
--- a/tools/klee/main.cpp
+++ b/tools/klee/main.cpp
@@ -190,6 +190,11 @@ namespace {
   cl::list<std::string>
   SeedOutDir("seed-out-dir");
 
+  cl::list<std::string>
+  LinkLibraries("link-llvm-lib",
+		cl::desc("Link the given libraries before execution"),
+		cl::value_desc("library file"));
+
   cl::opt<unsigned>
   MakeConcreteSymbolic("make-concrete-symbolic",
                        cl::desc("Probabilistic rate at which to make concrete reads symbolic, "
@@ -1303,6 +1308,14 @@ int main(int argc, char **argv, char **envp) {
     assert(mainModule && "unable to link with simple model");
   }
 
+  std::vector<std::string>::iterator libs_it;
+  std::vector<std::string>::iterator libs_ie;
+  for (libs_it = LinkLibraries.begin(), libs_ie = LinkLibraries.end();
+          libs_it != libs_ie; ++libs_it) {
+    const char * libFilename = libs_it->c_str();
+    klee_message("Linking in library: %s.\n", libFilename);
+    mainModule = klee::linkWithLibrary(mainModule, libFilename);
+  }
   // Get the desired main function.  klee_main initializes uClibc
   // locale and other data and then calls main.
   Function *mainFn = mainModule->getFunction(EntryPoint);