File amd-hipcc-use-rocm-suffix.patch of Package rocm-llvm

diff --git a/amd/hipcc/src/hipBin_amd.h b/amd/hipcc/src/hipBin_amd.h
index 57d009804..f6e1e5f58 100644
--- a/amd/hipcc/src/hipBin_amd.h
+++ b/amd/hipcc/src/hipBin_amd.h
@@ -154,7 +154,7 @@ void HipBinAmd::initializeHipLdFlags() {
   string hipLdFlags;
   const string& hipClangPath = getCompilerPath();
   // If $HIPCC clang++ is not compiled, use clang instead
-  string hipCC = "\"" + hipClangPath + "/clang++";
+  string hipCC = "\"" + hipClangPath + "/clang++-rocm\"";
   if (!fs::exists(hipCC)) {
     hipLdFlags = "--driver-mode=g++";
   }
@@ -202,16 +202,9 @@ void HipBinAmd::constructCompilerPath() {
   const EnvVariables& envVariables = getEnvVariables();
   if (envVariables.hipClangPathEnv_.empty()) {
     fs::path hipClangPath;
-    if (isWindows()) {
-      compilerPath = getHipPath();
-      hipClangPath = compilerPath;
-      hipClangPath /= "bin";
-    } else {
-      compilerPath = getRoccmPath();
-      hipClangPath = compilerPath;
-      hipClangPath /= "lib/llvm/bin";
-    }
-
+    compilerPath = getHipPath();
+    hipClangPath = compilerPath;
+    hipClangPath /= "bin";
     compilerPath = hipClangPath.string();
   } else {
     compilerPath = envVariables.hipClangPathEnv_;
@@ -241,9 +234,9 @@ void HipBinAmd::printCompilerInfo() const {
     system(cmd.c_str());  // ld flags
     cout << endl;
   } else {
-    string cmd = hipClangPath + "/clang++ --version";
+    string cmd = hipClangPath + "/clang++-rocm --version";
     system(cmd.c_str());  // hipclang version
-    cmd = hipClangPath + "/llc --version";
+    cmd = hipClangPath + "/llc-rocm --version";
     system(cmd.c_str());  // llc version
     cout << "hip-clang-cxxflags :" << endl;
     cmd = hipPath + "/bin/hipcc --cxxflags";
@@ -259,7 +252,7 @@ string HipBinAmd::getCompilerVersion() {
   string out, compilerVersion;
   const string& hipClangPath = getCompilerPath();
   fs::path cmdAmd = hipClangPath;
-  cmdAmd /= "clang++";
+  cmdAmd /= "clang++-rocm";
   if (canRunCompiler(cmdAmd.string(), out) || canRunCompiler("amdclang++", out)) {
     regex regexp("([0-9.]+)");
     smatch m;
@@ -320,7 +313,7 @@ bool HipBinAmd::detectPlatform() {
   constructCompilerPath();
   const string& hipClangPath = getCompilerPath();
   fs::path cmdAmd = hipClangPath;
-  cmdAmd /= "clang++";
+  cmdAmd /= "clang++-rocm";
   const EnvVariables& var = getEnvVariables();
   bool detected = false;
   if (var.hipPlatformEnv_.empty()) {
@@ -340,6 +333,8 @@ bool HipBinAmd::detectPlatform() {
   return detected;
 }
 
+#define LIBPATH(suffix) "lib" #suffix
+
 string HipBinAmd::getHipLibPath() const {
   string hipLibPath;
   const EnvVariables& env = getEnvVariables();
@@ -347,8 +342,8 @@ string HipBinAmd::getHipLibPath() const {
     hipLibPath = env.hipLibPathEnv_;
   }
   else if (!env.hipPathEnv_.empty()) {
-    fs::path p = env.hipLibPathEnv_;
-    p /= "lib";
+    fs::path p = env.hipPathEnv_;
+    p /= LIBPATH(HIPCC_LIB_SUFFIX);
     hipLibPath = p.string();
   }
   return hipLibPath;
@@ -361,11 +356,11 @@ string HipBinAmd::getHipCC() const {
   if (isWindows())
     compiler /= "clang.exe";
   else
-    compiler /= "clang++";
+    compiler /= "clang++-rocm";
 
   if (!fs::exists(compiler)) {
     fs::path compiler = hipClangPath;
-    compiler /= "clang";
+    compiler /= "clang-rocm";
   }
   hipCC = compiler.string();
 
@@ -752,7 +747,7 @@ void HipBinAmd::executeHipCCCmd(vector<string> argv) {
     } else if (os != windows) {
       // Else try using rocm_agent_enumerator
       string ROCM_AGENT_ENUM;
-      ROCM_AGENT_ENUM = roccmPath + "/bin/rocm_agent_enumerator";
+      ROCM_AGENT_ENUM = hipPath + "/bin/rocm_agent_enumerator";
       targetsStr = ROCM_AGENT_ENUM +" -t GPU";
       SystemCmdOut sysOut = hipBinUtilPtr_->exec(targetsStr.c_str());
       regex toReplace("\n+");
diff --git a/amd/hipcc/src/hipBin_base.h b/amd/hipcc/src/hipBin_base.h
index 6c1a7767b..923be28f3 100644
--- a/amd/hipcc/src/hipBin_base.h
+++ b/amd/hipcc/src/hipBin_base.h
@@ -342,7 +342,7 @@ void HipBinBase::constructRoccmPath() {
     fs::path rocm_agent_enumerator_file(roccm_path);
     rocm_agent_enumerator_file /= "bin/rocm_agent_enumerator";
     if (!fs::exists(rocm_agent_enumerator_file)) {
-      roccm_path = "/opt/rocm";
+      roccm_path = "/usr/rocm";
     }
     variables_.roccmPathEnv_ = roccm_path.string();
   } else {
openSUSE Build Service is sponsored by