[llvm] [llvm-bolt] Modify `getLibPath` to enable `--runtime-instrumentation-lib` option handle full path correctly.(llvm#99772) (PR #99806)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 21 02:27:08 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-bolt

Author: Zimo Ji (lltsdyp)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/99806.diff


1 Files Affected:

- (modified) bolt/lib/RuntimeLibs/RuntimeLibrary.cpp (+6) 


``````````diff
diff --git a/bolt/lib/RuntimeLibs/RuntimeLibrary.cpp b/bolt/lib/RuntimeLibs/RuntimeLibrary.cpp
index 276b034d71f96..0826847ee1189 100644
--- a/bolt/lib/RuntimeLibs/RuntimeLibrary.cpp
+++ b/bolt/lib/RuntimeLibs/RuntimeLibrary.cpp
@@ -28,6 +28,12 @@ void RuntimeLibrary::anchor() {}
 
 std::string RuntimeLibrary::getLibPath(StringRef ToolPath,
                                        StringRef LibFileName) {
+  // Handle full path.
+  // It is weird that append LibFileName to LibPath when user gives a full path.
+  if(LibFileName[0]=='/')
+  {
+    return LibFileName.str();
+  }
   StringRef Dir = llvm::sys::path::parent_path(ToolPath);
   SmallString<128> LibPath = llvm::sys::path::parent_path(Dir);
   llvm::sys::path::append(LibPath, "lib" LLVM_LIBDIR_SUFFIX);

``````````

</details>


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


More information about the llvm-commits mailing list