summaryrefslogtreecommitdiff
path: root/sys-devel/llvm-roc/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2021-01-22 20:28:19 +0000
committerV3n3RiX <venerix@redcorelinux.org>2021-01-22 20:28:19 +0000
commitabaa75b10f899ada8dd05b23cc03205064394bc6 (patch)
treeeca3dd248b73b92013cba00a0fcc1edf2696e19a /sys-devel/llvm-roc/files
parent24fd814c326e282c4321965c31f341dad77e270d (diff)
gentoo resync : 22.01.2021
Diffstat (limited to 'sys-devel/llvm-roc/files')
-rw-r--r--sys-devel/llvm-roc/files/llvm-roc-4.0.0-hip-location.patch47
-rw-r--r--sys-devel/llvm-roc/files/llvm-roc-4.0.0-remove-isystem-usr-include.patch29
2 files changed, 76 insertions, 0 deletions
diff --git a/sys-devel/llvm-roc/files/llvm-roc-4.0.0-hip-location.patch b/sys-devel/llvm-roc/files/llvm-roc-4.0.0-hip-location.patch
new file mode 100644
index 000000000000..8342299f1139
--- /dev/null
+++ b/sys-devel/llvm-roc/files/llvm-roc-4.0.0-hip-location.patch
@@ -0,0 +1,47 @@
+replace hardcoded hip finder with Gentoo paths.
+
+Author: Benda Xu <heroxbd@gentoo.org>
+
+Index: llvm-project-rocm-4.0.0/clang/lib/Driver/ToolChains/AMDGPU.cpp
+===================================================================
+--- llvm-project-rocm-4.0.0.orig/clang/lib/Driver/ToolChains/AMDGPU.cpp
++++ llvm-project-rocm-4.0.0/clang/lib/Driver/ToolChains/AMDGPU.cpp
+@@ -116,37 +116,8 @@ RocmInstallationDetector::getInstallatio
+ return Candidates;
+ }
+
+- // Try to find relative to the compiler binary.
+- const char *InstallDir = D.getInstalledDir();
++ Candidates.emplace_back(D.SysRoot + "/usr/lib/hip", /*StrictChecking=*/true);
+
+- // Check both a normal Unix prefix position of the clang binary, as well as
+- // the Windows-esque layout the ROCm packages use with the host architecture
+- // subdirectory of bin.
+-
+- // Strip off directory (usually bin)
+- StringRef ParentDir = llvm::sys::path::parent_path(InstallDir);
+- StringRef ParentName = llvm::sys::path::filename(ParentDir);
+-
+- // Some builds use bin/{host arch}, so go up again.
+- if (ParentName == "bin") {
+- ParentDir = llvm::sys::path::parent_path(ParentDir);
+- ParentName = llvm::sys::path::filename(ParentDir);
+- }
+-
+- // Some versions of the rocm llvm package install to /opt/rocm/llvm/bin
+- if (ParentName == "llvm")
+- ParentDir = llvm::sys::path::parent_path(ParentDir);
+-
+- Candidates.emplace_back(ParentDir.str(), /*StrictChecking=*/true);
+-
+- // Device library may be installed in clang resource directory.
+- Candidates.emplace_back(D.ResourceDir, /*StrictChecking=*/true);
+-
+- Candidates.emplace_back(D.SysRoot + "/opt/rocm", /*StrictChecking=*/true);
+- if (ParentName.startswith("aomp")) {
+- // Some versions of the aomp package install to /opt/rocm/aomp/bin
+- Candidates.emplace_back(ParentDir.str());
+- }
+ return Candidates;
+ }
+
diff --git a/sys-devel/llvm-roc/files/llvm-roc-4.0.0-remove-isystem-usr-include.patch b/sys-devel/llvm-roc/files/llvm-roc-4.0.0-remove-isystem-usr-include.patch
new file mode 100644
index 000000000000..f14ec4ac0db2
--- /dev/null
+++ b/sys-devel/llvm-roc/files/llvm-roc-4.0.0-remove-isystem-usr-include.patch
@@ -0,0 +1,29 @@
+Author: Wilfried (justxi) Holzke
+
+Adopted from https://github.com/justxi/rocm/blob/master/sys-devel/llvm-roc/files/llvm-roc-4.0.0-remove-isystem-usr-include.patch
+
+Index: llvm-project-rocm-4.0.0/clang/lib/Driver/ToolChains/AMDGPU.cpp
+===================================================================
+--- llvm-project-rocm-4.0.0.orig/clang/lib/Driver/ToolChains/AMDGPU.cpp
++++ llvm-project-rocm-4.0.0/clang/lib/Driver/ToolChains/AMDGPU.cpp
+@@ -326,11 +326,6 @@ void RocmInstallationDetector::AddHIPInc
+ //
+ // ROCm 3.5 does not fully support the wrapper headers. Therefore it needs
+ // a workaround.
+- SmallString<128> P(D.ResourceDir);
+- if (UsesRuntimeWrapper)
+- llvm::sys::path::append(P, "include", "cuda_wrappers");
+- CC1Args.push_back("-internal-isystem");
+- CC1Args.push_back(DriverArgs.MakeArgString(P));
+ }
+
+ if (DriverArgs.hasArg(options::OPT_nogpuinc))
+@@ -341,8 +336,6 @@ void RocmInstallationDetector::AddHIPInc
+ return;
+ }
+
+- CC1Args.push_back("-internal-isystem");
+- CC1Args.push_back(DriverArgs.MakeArgString(getIncludePath()));
+ if (UsesRuntimeWrapper)
+ CC1Args.append({"-include", "__clang_hip_runtime_wrapper.h"});
+ }