about summary refs log tree commit diff homepage
path: root/tools
diff options
context:
space:
mode:
authorMartin Nowack <martin@se.inf.tu-dresden.de>2014-04-30 15:31:57 +0200
committerMartin Nowack <martin@se.inf.tu-dresden.de>2014-07-09 17:15:19 +0200
commit7a945ed5067147180054c66c77a1df8893705e46 (patch)
tree474de52d96fbacb8e33404540f9a65b258b64486 /tools
parent75f71cf58f8bea99a22228925e44fd2b330e4007 (diff)
downloadklee-7a945ed5067147180054c66c77a1df8893705e46.tar.gz
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,