[clang] [HIP] Remove dots in HIP runtime path (PR #143792)

Siu Chi Chan via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 11 14:49:21 PDT 2025


https://github.com/scchan created https://github.com/llvm/llvm-project/pull/143792

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

>From 4519fbaec265c0b927e235516c72869cf128aa62 Mon Sep 17 00:00:00 2001
From: Siu Chi Chan <siuchi.chan at amd.com>
Date: Wed, 11 Jun 2025 17:18:42 -0400
Subject: [PATCH] [HIP] Remove dots in HIP runtime path Remove the dots in the
 HIP path before passing to the rpath flag

---
 clang/lib/Driver/ToolChains/Linux.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

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");
 }



More information about the cfe-commits mailing list