File amd-comgr-fix-compiler.patch of Package rocm-llvm

diff --git a/amd/comgr/src/comgr-compiler.cpp b/amd/comgr/src/comgr-compiler.cpp
index 9f39b939d..25887cd56 100644
--- a/amd/comgr/src/comgr-compiler.cpp
+++ b/amd/comgr/src/comgr-compiler.cpp
@@ -616,7 +616,7 @@ static amd_comgr_status_t linkWithLLD(llvm::ArrayRef<const char *> Args,
                                       llvm::raw_ostream &LogE) {
   ArgStringList LLDArgs(llvm::iterator_range<ArrayRef<const char *>::iterator>(
       Args.begin(), Args.end()));
-  LLDArgs.insert(LLDArgs.begin(), "ld.lld");
+  LLDArgs.insert(LLDArgs.begin(), "ld.lld-rocm");
   LLDArgs.push_back("--threads=1");
 
   ArrayRef<const char *> ArgRefs = llvm::ArrayRef(LLDArgs);
@@ -668,7 +668,7 @@ AMDGPUCompiler::executeInProcessDriver(ArrayRef<const char *> Args) {
   DiagnosticsEngine Diags(DiagID, &*DiagOpts, DiagClient);
   ProcessWarningOptions(Diags, *DiagOpts, /*ReportDiags=*/false);
 
-  Driver TheDriver((Twine(env::getLLVMPath()) + "/bin/clang").str(), "", Diags);
+  Driver TheDriver((Twine(env::getLLVMPath()) + "/bin/clang-rocm").str(), "", Diags);
   TheDriver.setTitle("AMDGPU Code Object Manager");
   TheDriver.setCheckInputsExist(false);
 
@@ -706,7 +706,7 @@ AMDGPUCompiler::executeInProcessDriver(ArrayRef<const char *> Args) {
 
     if (Argv[1] == StringRef("-cc1")) {
       if (env::shouldEmitVerboseLogs()) {
-        logArgv(LogS, "clang", Argv);
+        logArgv(LogS, "clang-rocm", Argv);
       }
 
       std::unique_ptr<CompilerInstance> Clang(new CompilerInstance());
@@ -730,7 +730,7 @@ AMDGPUCompiler::executeInProcessDriver(ArrayRef<const char *> Args) {
       }
     } else if (Argv[1] == StringRef("-cc1as")) {
       if (env::shouldEmitVerboseLogs()) {
-        logArgv(LogS, "clang", Argv);
+        logArgv(LogS, "clang-rocm", Argv);
       }
       Argv.erase(Argv.begin() + 1);
       if (!Argv.back()) {
@@ -748,7 +748,7 @@ AMDGPUCompiler::executeInProcessDriver(ArrayRef<const char *> Args) {
       }
     } else if (Job.getCreator().getName() == LinkerJobName) {
       if (env::shouldEmitVerboseLogs()) {
-        logArgv(LogS, "lld", Argv);
+        logArgv(LogS, "lld-rocm", Argv);
       }
       if (auto Status = linkWithLLD(Arguments, LogS, LogS)) {
         return Status;
@@ -1030,10 +1030,6 @@ AMDGPUCompiler::addTargetIdentifierFlags(llvm::StringRef IdentStr,
 }
 
 amd_comgr_status_t AMDGPUCompiler::addCompilationFlags() {
-  HIPIncludePath = (Twine(env::getHIPPath()) + "/include").str();
-  // HIP headers depend on hsa.h which is in ROCM_DIR/include.
-  ROCMIncludePath = (Twine(env::getROCMPath()) + "/include").str();
-
   Args.push_back("-x");
 
   switch (ActionInfo->Language) {
@@ -1056,10 +1052,6 @@ amd_comgr_status_t AMDGPUCompiler::addCompilationFlags() {
     Args.push_back("-target");
     Args.push_back("x86_64-unknown-linux-gnu");
     Args.push_back("--cuda-device-only");
-    Args.push_back("-isystem");
-    Args.push_back(ROCMIncludePath.c_str());
-    Args.push_back("-isystem");
-    Args.push_back(HIPIncludePath.c_str());
     break;
   default:
     return AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT;
diff --git a/amd/comgr/src/comgr-env.cpp b/amd/comgr/src/comgr-env.cpp
index b22a9b3e6..b18a8681d 100644
--- a/amd/comgr/src/comgr-env.cpp
+++ b/amd/comgr/src/comgr-env.cpp
@@ -161,15 +161,13 @@ public:
   void setROCmInstallPath(StringRef Path) { ROCmInstallPath = Path; }
 
   virtual SmallString<128> getLLVMPathImpl() {
-    SmallString<128> LLVMPath = getROCmPath();
-    sys::path::append(LLVMPath, "llvm");
+    static StringRef LLVMPath("/usr");
 
     return LLVMPath;
   }
 
   virtual SmallString<128> getHIPPathImpl() {
-    SmallString<128> HIPPath = getROCmPath();
-    sys::path::append(HIPPath, "hip");
+    static StringRef HIPPath("/usr");
 
     return HIPPath;
   }
@@ -266,9 +264,7 @@ InstallationDetector *getDetectorImpl() {
 
   InstallationDetector *Detector;
   if (ROCmInstallPath == "") {
-    std::string ComgrInstallationPath = getComgrInstallPathFromExecutable();
-    Detector =
-        CreatePathDetector(ComgrInstallationPath, true /* isComgrPath */);
+    Detector = CreatePathDetector("/usr/rocm");
   } else {
     Detector = CreatePathDetector(ROCmInstallPath);
   }
openSUSE Build Service is sponsored by