diff options
author | Damir Shaykhutdinov <lost404@gmail.com> | 2016-05-10 14:09:55 +0300 |
---|---|---|
committer | Damir Shaykhutdinov <lost404@gmail.com> | 2016-05-20 14:09:02 +0300 |
commit | b5c41d2689c2b05987232a1e206e6a1ac46b8489 (patch) | |
tree | 77a1b3e612a96a1f8a4da4763e92cf05e83f0609 /tools | |
parent | 8fdfd4f7c7ff0368db5b16d48bf51ff38493b8a6 (diff) | |
download | klee-b5c41d2689c2b05987232a1e206e6a1ac46b8489.tar.gz |
Allow relocation of installed klee tree
If klee is configured with certain bindir and runtime dir, allow klee to be relocated, as long as subdirectory structure remains intact. For example, if klee is configured with bindir /usr/bin, and with runtime dir /usr/lib/klee, but is relocated to certain directory $RDIR, then running $RDIR/usr/bin/klee will search for runtime libraries in $RDIR/usr/lib/klee. Klee will use global runtime directory only when installed to global binary directory. Inspired by relocation code in gcc.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/klee/main.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp index 80161caa..7fe64c72 100644 --- a/tools/klee/main.cpp +++ b/tools/klee/main.cpp @@ -606,11 +606,15 @@ std::string KleeHandler::getRunTimeLibraryPath(const char *argv0) { SmallString<128> libDir; - if ( strcmp(toolRoot.c_str(), KLEE_INSTALL_BIN_DIR ) == 0) + if (strlen( KLEE_INSTALL_BIN_DIR ) != 0 && + strlen( KLEE_INSTALL_RUNTIME_DIR ) != 0 && + toolRoot.str().endswith( KLEE_INSTALL_BIN_DIR )) { KLEE_DEBUG_WITH_TYPE("klee_runtime", llvm::dbgs() << "Using installed KLEE library runtime: "); - libDir = KLEE_INSTALL_RUNTIME_DIR ; + libDir = toolRoot.str().substr(0, + toolRoot.str().size() - strlen( KLEE_INSTALL_BIN_DIR )); + llvm::sys::path::append(libDir, KLEE_INSTALL_RUNTIME_DIR); } else { |