commit:     2e75b4dd03e756ae15367b47e618b03d74fc2347
Author:     Sv. Lockal <lockalsash <AT> gmail <DOT> com>
AuthorDate: Sat Nov 15 09:34:56 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Nov 16 09:14:51 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2e75b4dd

dev-util/hip: fix libc++ #include <ranges> in HIP code

Closes: https://bugs.gentoo.org/965954
Signed-off-by: Sv. Lockal <lockalsash <AT> gmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/44633
Closes: https://github.com/gentoo/gentoo/pull/44633
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../hip/files/hip-7.0.2-fix-libcxx-noinline.patch     |  2 ++
 dev-util/hip/files/hip-7.0.2-fix-libcxx-ranges.patch  | 19 +++++++++++++++++++
 dev-util/hip/hip-7.1.0.ebuild                         |  1 +
 3 files changed, 22 insertions(+)

diff --git a/dev-util/hip/files/hip-7.0.2-fix-libcxx-noinline.patch 
b/dev-util/hip/files/hip-7.0.2-fix-libcxx-noinline.patch
index 28f8e7e55d11..0f77fbf76971 100644
--- a/dev-util/hip/files/hip-7.0.2-fix-libcxx-noinline.patch
+++ b/dev-util/hip/files/hip-7.0.2-fix-libcxx-noinline.patch
@@ -1,4 +1,6 @@
 Unsetting __noinline__ before inclusion of libc++ __config breaks libc++ 
headers.
+
+Upstream PR: https://github.com/ROCm/rocm-systems/pull/1875
 --- a/hipamd/include/hip/amd_detail/host_defines.h
 +++ b/hipamd/include/hip/amd_detail/host_defines.h
 @@ -257,6 +257,13 @@ typedef __hip_internal::int64_t __hip_int64_t;

diff --git a/dev-util/hip/files/hip-7.0.2-fix-libcxx-ranges.patch 
b/dev-util/hip/files/hip-7.0.2-fix-libcxx-ranges.patch
new file mode 100644
index 000000000000..cbb6035d5df9
--- /dev/null
+++ b/dev-util/hip/files/hip-7.0.2-fix-libcxx-ranges.patch
@@ -0,0 +1,19 @@
+Defining __local before inclusion of libc++ <ranges> causes compilation errors.
+
+Upstream PR: https://github.com/ROCm/rocm-systems/pull/1875
+--- a/hipamd/include/hip/amd_detail/device_library_decls.h
++++ b/hipamd/include/hip/amd_detail/device_library_decls.h
+@@ -120,6 +120,13 @@ extern "C" __device__ __hip_uint64_t 
__ockl_fprintf_append_string_n(__hip_uint64
+                                                                     
__hip_uint64_t length,
+                                                                     
__hip_uint32_t is_last);
+ 
++// libc++ <ranges> uses __local as function name; include one file, before 
defining __local macro
++#if defined(__cplusplus) && defined(_LIBCPP_VERSION) && defined(__has_include)
++#  if __has_include (<__ranges/join_view.h>)
++#    include <__ranges/join_view.h>
++#  endif
++#endif
++
+ // Introduce local address space
+ #define __local __attribute__((address_space(3)))
+ 

diff --git a/dev-util/hip/hip-7.1.0.ebuild b/dev-util/hip/hip-7.1.0.ebuild
index 4e90c13c7a81..b891484de5a9 100644
--- a/dev-util/hip/hip-7.1.0.ebuild
+++ b/dev-util/hip/hip-7.1.0.ebuild
@@ -90,6 +90,7 @@ PATCHES=(
        "${FILESDIR}/${PN}-6.3.0-clr-fix-libcxx.patch"
        "${FILESDIR}/${PN}-6.4.1-no-glibcxx-assert.patch"
        "${FILESDIR}/${PN}-7.0.2-fix-libcxx-noinline.patch"
+       "${FILESDIR}/${PN}-7.0.2-fix-libcxx-ranges.patch"
 )
 
 QA_FLAGS_IGNORED="usr/lib.*/libhiprtc-builtins.*"

Reply via email to