Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

lltsdyp
Copy link

@lltsdyp lltsdyp commented Jul 21, 2024

No description provided.

Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be
notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write
permissions for the repository. In which case you can instead tag reviewers by
name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review
by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate
is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot llvmbot added the BOLT label Jul 21, 2024
@llvmbot
Copy link
Member

llvmbot commented Jul 21, 2024

@llvm/pr-subscribers-bolt

Author: Zimo Ji (lltsdyp)

Changes

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

1 Files Affected:

  • (modified) bolt/lib/RuntimeLibs/RuntimeLibrary.cpp (+6)
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);

@lltsdyp lltsdyp changed the title [llvm-bolt] Modify getLibPath to enable --runtime-instrumentation-lib option handle full path correctly.(llvm#99772) [llvm-bolt] Modify getLibPath to enable --runtime-instrumentation-lib option handle full path correctly.(lhttps://github.com/llvm/llvm-project/issues/99772) Jul 21, 2024
@lltsdyp lltsdyp changed the title [llvm-bolt] Modify getLibPath to enable --runtime-instrumentation-lib option handle full path correctly.(lhttps://github.com/llvm/llvm-project/issues/99772) [llvm-bolt] Modify getLibPath to enable --runtime-instrumentation-lib option handle full path correctly.(https://github.com/llvm/llvm-project/issues/99772) Jul 21, 2024
@lltsdyp lltsdyp changed the title [llvm-bolt] Modify getLibPath to enable --runtime-instrumentation-lib option handle full path correctly.(https://github.com/llvm/llvm-project/issues/99772) [llvm-bolt] Modify getLibPath to enable --runtime-instrumentation-lib option handle full path correctly.(llvm[#99772](https://github.com/llvm/llvm-project/issues/99772)) Jul 21, 2024
@lltsdyp lltsdyp changed the title [llvm-bolt] Modify getLibPath to enable --runtime-instrumentation-lib option handle full path correctly.(llvm[#99772](https://github.com/llvm/llvm-project/issues/99772)) [llvm-bolt] Modify getLibPath to enable --runtime-instrumentation-lib option handle full path correctly.(llvm#99772) Jul 21, 2024
lltsdyp added 2 commits July 21, 2024 20:14
In my previous commit, I forget to add an error ha
ndler when given full path.
@lltsdyp
Copy link
Author

lltsdyp commented Jul 21, 2024

Hmm, I forgot to verify the existence of the runtime instrumentation library so I modified it and open a new PR

@lltsdyp lltsdyp closed this Jul 21, 2024
@lltsdyp lltsdyp reopened this Jul 21, 2024
@lltsdyp
Copy link
Author

lltsdyp commented Jul 21, 2024

Oops, it seems like my new commits were included in this PR so I don't need to open a new PR
Sorry for that, I am a noob :)

@rafaelauler
Copy link
Contributor

Thanks for the fix! Currently #97130 PR is already working on this function, though. If that PR doesn't land, we can land this one.

@peterwaller-arm
Copy link
Contributor

@lltsdyp the above PR now landed; looks like there are straightforward conflicts to resolve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants