about summary refs log tree commit diff homepage
path: root/tools
diff options
context:
space:
mode:
authorCristian Cadar <c.cadar@imperial.ac.uk>2014-07-10 13:52:05 +0100
committerCristian Cadar <c.cadar@imperial.ac.uk>2014-07-10 13:52:05 +0100
commitf88e6b872d2470b662f1c50b954268ecbcbd7034 (patch)
tree474de52d96fbacb8e33404540f9a65b258b64486 /tools
parent75f71cf58f8bea99a22228925e44fd2b330e4007 (diff)
parent7a945ed5067147180054c66c77a1df8893705e46 (diff)
downloadklee-f88e6b872d2470b662f1c50b954268ecbcbd7034.tar.gz
Merge pull request #137 from MartinNowack/fix_cxx_standard
Fix to avoid warning message taking address of main
Diffstat (limited to 'tools')
-rw-r--r--tools/klee/main.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp
index 0292376c..aecf6991 100644
--- a/tools/klee/main.cpp
+++ b/tools/klee/main.cpp
@@ -262,7 +262,7 @@ public:
   static void getOutFiles(std::string path,
 			  std::vector<std::string> &results);
 
-  static std::string getRunTimeLibraryPath(const char* argv0, void *MainExecAddr);
+  static std::string getRunTimeLibraryPath(const char *argv0);
 };
 
 KleeHandler::KleeHandler(int argc, char **argv) 
@@ -564,8 +564,10 @@ void KleeHandler::getOutFiles(std::string path,
   }
 }
 
-std::string KleeHandler::getRunTimeLibraryPath(const char* argv0, void* MainExecAddr)
-{
+std::string KleeHandler::getRunTimeLibraryPath(const char *argv0) {
+  // Take any function from the execution binary but not main (as not allowed by
+  // C++ standard)
+  void *MainExecAddr = (void *)(intptr_t)getRunTimeLibraryPath;
   SmallString<128> toolRoot(
       #if LLVM_VERSION_CODE >= LLVM_VERSION(3,4)
       llvm::sys::fs::getMainExecutable(argv0, MainExecAddr)
@@ -1259,8 +1261,7 @@ int main(int argc, char **argv, char **envp) {
       return r;
   }
 
-  std::string LibraryDir = KleeHandler::getRunTimeLibraryPath(argv[0],
-                              reinterpret_cast<void*>(main));
+  std::string LibraryDir = KleeHandler::getRunTimeLibraryPath(argv[0]);
   Interpreter::ModuleOptions Opts(LibraryDir.c_str(),
                                   /*Optimize=*/OptimizeModule, 
                                   /*CheckDivZero=*/CheckDivZero,