[llvm] [BOLT] Enable standalone build (PR #97130)

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 25 10:25:44 PDT 2024


================
@@ -38,13 +38,36 @@ std::string RuntimeLibrary::getLibPath(StringRef ToolPath,
     llvm::sys::path::append(LibPath, "lib" LLVM_LIBDIR_SUFFIX);
   }
   llvm::sys::path::append(LibPath, LibFileName);
-  if (!llvm::sys::fs::exists(LibPath)) {
-    errs() << "BOLT-ERROR: library not found: " << LibPath << "\n";
-    exit(1);
-  }
   return std::string(LibPath);
 }
 
+std::string RuntimeLibrary::getLibPathByInstalled(StringRef LibFileName) {
+  SmallString<128> LibPath(CMAKE_INSTALL_FULL_LIBDIR);
----------------
nico wrote:

This embeds a full absolute path into the bolt binary. That doesn't seem great, since it means that that library has to be at that particular path. Other tools instead require a fixed relative path from executable to runtime library (with an overridable setting).

See `Driver::GetResourcesPath` in clang/lib/Driver/Driver.cpp (and its caller, in the same file), and `ToolChain::getCompilerRTPath()` in clang/lib/Driver/ToolChain.cpp.

https://github.com/llvm/llvm-project/pull/97130


More information about the llvm-commits mailing list