From 43a35716e3e7dc3c176385cf855b0bd8ccb18e82 Mon Sep 17 00:00:00 2001 From: "Sv. Lockal" Date: Mon, 6 May 2024 14:56:00 +0000 Subject: dev-libs/rocr-runtime: fix crash in musl and compile issue with ld.lld Upstream issues: * https://github.com/ROCm/ROCR-Runtime/issues/181#issuecomment-2096231767 * https://github.com/ROCm/ROCR-Runtime/issues/204 Signed-off-by: Sv. Lockal Signed-off-by: Sam James --- .../files/rocr-runtime-6.1.0-ld-lld.patch | 17 +++++++++ .../files/rocr-runtime-6.1.0-musl.patch | 40 ++++++++++++++++------ dev-libs/rocr-runtime/rocr-runtime-6.1.1.ebuild | 1 + 3 files changed, 47 insertions(+), 11 deletions(-) create mode 100644 dev-libs/rocr-runtime/files/rocr-runtime-6.1.0-ld-lld.patch (limited to 'dev-libs') diff --git a/dev-libs/rocr-runtime/files/rocr-runtime-6.1.0-ld-lld.patch b/dev-libs/rocr-runtime/files/rocr-runtime-6.1.0-ld-lld.patch new file mode 100644 index 000000000000..fb5d3d341967 --- /dev/null +++ b/dev-libs/rocr-runtime/files/rocr-runtime-6.1.0-ld-lld.patch @@ -0,0 +1,17 @@ +Fix "symbol not defined" when linking with ld.lld >= 17 +https://github.com/ROCm/ROCR-Runtime/issues/204 +--- a/hsacore.so.def ++++ b/hsacore.so.def +@@ -246,12 +246,6 @@ global: + hsa_amd_vmem_retain_alloc_handle; + hsa_amd_vmem_get_alloc_properties_from_handle; + hsa_amd_agent_set_async_scratch_limit; +- hsa_tools_scratch_event_alloc_start; +- hsa_tools_scratch_event_alloc_end; +- hsa_tools_scratch_event_free_start; +- hsa_tools_scratch_event_free_end; +- hsa_tools_scratch_event_async_reclaim_start; +- hsa_tools_scratch_event_async_reclaim_end; + + local: + *; diff --git a/dev-libs/rocr-runtime/files/rocr-runtime-6.1.0-musl.patch b/dev-libs/rocr-runtime/files/rocr-runtime-6.1.0-musl.patch index 699f9251d705..7554c8c79ec1 100644 --- a/dev-libs/rocr-runtime/files/rocr-runtime-6.1.0-musl.patch +++ b/dev-libs/rocr-runtime/files/rocr-runtime-6.1.0-musl.patch @@ -1,8 +1,6 @@ -Fix compilation with musl. +Fix compilation and symbol search with musl. Bug: https://github.com/ROCm/ROCR-Runtime/issues/181 -Index: src/core/inc/checked.h -=================================================================== --- src.orig/core/inc/checked.h +++ src/core/inc/checked.h @@ -58,7 +58,7 @@ template + #endif + ++/* ++ * d_un.d_ptr is relative on non glibc systems ++ * elf(5) documents it this way, glibc diverts from this documentation ++ */ ++#ifdef __GLIBC__ ++#define ABS_ADDR(base, ptr) (ptr) ++#else ++#define ABS_ADDR(base, ptr) ((base) + (ptr)) ++#endif ++ + namespace rocr { + namespace os { + +@@ -299,7 +309,7 @@ static int callback(struct dl_phdr_info* info, size_t size, void* data) { + for (int j = 0;; j++) { + if (dyn_section[j].d_tag == DT_NULL) break; + +- if (dyn_section[j].d_tag == DT_STRTAB) strings = (char*)(dyn_section[j].d_un.d_ptr); ++ if (dyn_section[j].d_tag == DT_STRTAB) strings = (char*)ABS_ADDR(info->dlpi_addr, dyn_section[j].d_un.d_ptr); + + if (dyn_section[j].d_tag == DT_STRSZ) limit = dyn_section[j].d_un.d_val; + } diff --git a/dev-libs/rocr-runtime/rocr-runtime-6.1.1.ebuild b/dev-libs/rocr-runtime/rocr-runtime-6.1.1.ebuild index 8b2730bd07e2..06778711004a 100644 --- a/dev-libs/rocr-runtime/rocr-runtime-6.1.1.ebuild +++ b/dev-libs/rocr-runtime/rocr-runtime-6.1.1.ebuild @@ -23,6 +23,7 @@ PATCHES=( "${FILESDIR}/${PN}-4.3.0_no-aqlprofiler.patch" "${FILESDIR}/${PN}-5.7.1-extend-isa-compatibility-check.patch" "${FILESDIR}/${PN}-6.1.0-musl.patch" + "${FILESDIR}/${PN}-6.1.0-ld-lld.patch" ) LICENSE="MIT" -- cgit v1.2.3-65-gdbad