Skip to content

Conversation

@scchan
Copy link
Contributor

@scchan scchan commented Jun 11, 2025

Remove the dots in the HIP path before passing to the rpath flag

@scchan scchan requested a review from yxsamliu June 11, 2025 21:49
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' labels Jun 11, 2025
@llvmbot
Copy link
Member

llvmbot commented Jun 11, 2025

@llvm/pr-subscribers-clang-driver

@llvm/pr-subscribers-clang

Author: Siu Chi Chan (scchan)

Changes

Remove the dots in the HIP path before passing to the rpath flag


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

1 Files Affected:

  • (modified) clang/lib/Driver/ToolChains/Linux.cpp (+5-2)
diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
index 151b2bfced818..9bfe3a9346efa 100644
--- a/clang/lib/Driver/ToolChains/Linux.cpp
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
@@ -743,9 +743,12 @@ void Linux::AddHIPRuntimeLibArgs(const ArgList &Args,
       Args.MakeArgString(StringRef("-L") + RocmInstallation->getLibPath()));
 
   if (Args.hasFlag(options::OPT_frtlib_add_rpath,
-                   options::OPT_fno_rtlib_add_rpath, false))
+                   options::OPT_fno_rtlib_add_rpath, false)) {
+    SmallString<0> p = RocmInstallation->getLibPath();
+    llvm::sys::path::remove_dots(p);
     CmdArgs.append(
-        {"-rpath", Args.MakeArgString(RocmInstallation->getLibPath())});
+        {"-rpath", Args.MakeArgString(p)});
+  }
 
   CmdArgs.push_back("-lamdhip64");
 }

@github-actions
Copy link

github-actions bot commented Jun 11, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@scchan scchan force-pushed the users/scchan/hip_rpath_remove_dots branch from 4519fba to 9c60ee7 Compare June 18, 2025 23:19
Remove the dots in the HIP path before passing to the rpath flag
@scchan scchan force-pushed the users/scchan/hip_rpath_remove_dots branch from 9c60ee7 to 62e627e Compare June 18, 2025 23:21
@scchan scchan requested a review from yxsamliu June 18, 2025 23:23
{"-rpath", Args.MakeArgString(RocmInstallation->getLibPath())});
options::OPT_fno_rtlib_add_rpath, false)) {
SmallString<0> p = RocmInstallation->getLibPath();
llvm::sys::path::remove_dots(p, true);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so far the preferred style is like remove_dots(p, /*remove_dot_dot=*/ true);

@scchan scchan merged commit 7e8f1f5 into llvm:main Jun 19, 2025
7 checks passed
searlmc1 pushed a commit to ROCm/llvm-project that referenced this pull request Jun 23, 2025
Remove the dots in the HIP path before passing to the rpath flag
searlmc1 pushed a commit to ROCm/llvm-project that referenced this pull request Jun 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants