c_josie_overlay

roct-thunk-interface 10.1: export hsaKmtCreateQueueV2 + extsem symbols

libhsa-runtime64 references five hsaKmt symbols that 10.1's libhsakmt does
not export, so linking rocminfo fails with undefined references.

- hsaKmtCreateQueueV2 is defined but absent from libhsakmt.ver, so the
  'local: *;' version script hides it: add it to the script.
- the four hsaKmt*ExternalSemaphore helpers in src/extsem.c are the only
  exported functions whose source includes the public hsakmt.h instead of
  the internal libhsakmt.h; HSAKMTAPI is empty in the public header and the
  build uses -fvisibility=hidden, so they were compiled hidden. Wrap them in
  '#pragma GCC visibility push(default)'.

36aaa3951a568c5f71cde98f92e6ac1f0cefb8d5
cjosie <administrator@josie-c.com> · 2026-10-14T20:51 · browse files at this commit

parents: ee89148

diff --git a/dev-libs/roct-thunk-interface/files/roct-thunk-interface-10.1-export-symbols.patch b/dev-libs/roct-thunk-interface/files/roct-thunk-interface-10.1-export-symbols.patch
new file mode 100644
index 0000000..e139363
--- /dev/null
+++ b/dev-libs/roct-thunk-interface/files/roct-thunk-interface-10.1-export-symbols.patch
@@ -0,0 +1,44 @@
+Export two things 10.1's libhsakmt drops, both needed by libhsa-runtime64
+(so the rocminfo link fails with "undefined reference" against libhsa-runtime64):
+
+* hsaKmtCreateQueueV2 is defined (visible) but absent from libhsakmt.ver, so
+  the "local: *;" version script hides it.
+* The four hsaKmt*ExternalSemaphore helpers in src/extsem.c are the only
+  exported functions whose file includes the public hsakmt.h instead of the
+  internal libhsakmt.h; since HSAKMTAPI is empty in the public header and the
+  build uses -fvisibility=hidden, they are compiled hidden and never exported.
+
+--- a/src/libhsakmt.ver
++++ b/src/libhsakmt.ver
+@@ -20,6 +20,7 @@
+ hsaKmtWaitOnMultipleEvents;
+ hsaKmtCreateQueue;
+ hsaKmtUpdateQueue;
++hsaKmtCreateQueueV2;
+ hsaKmtDestroyQueue;
+ hsaKmtSetQueueCUMask;
+ hsaKmtSetMemoryPolicy;
+--- a/src/extsem.c
++++ b/src/extsem.c
+@@ -6,6 +6,13 @@
+ 
+ #include "hsakmt/hsakmt.h"
+ 
++/* HSAKMTAPI is empty in the public header while the library is built with
++ * -fvisibility=hidden, so these helpers (the only ones not including the
++ * internal libhsakmt.h) end up hidden and drop out of the version script. */
++#if defined(__GNUC__)
++#pragma GCC visibility push(default)
++#endif
++
+ HSAKMT_STATUS HSAKMTAPI hsaKmtImportExternalSemaphore(
+     HSAuint32 NodeId, void *NtHandle,
+     HSA_EXTERNAL_SEMAPHORE_HANDLE_TYPE Type,
+@@ -33,3 +40,7 @@
+   (void)QueueId; (void)Handle; (void)Value;
+   return HSAKMT_STATUS_NOT_SUPPORTED;
+ }
++
++#if defined(__GNUC__)
++#pragma GCC visibility pop
++#endif
diff --git a/dev-libs/roct-thunk-interface/roct-thunk-interface-10.1.ebuild b/dev-libs/roct-thunk-interface/roct-thunk-interface-10.1.ebuild
index 5317214..158996d 100644
--- a/dev-libs/roct-thunk-interface/roct-thunk-interface-10.1.ebuild
+++ b/dev-libs/roct-thunk-interface/roct-thunk-interface-10.1.ebuild
@@ -41,6 +41,7 @@ CMAKE_BUILD_TYPE=Release
 
 PATCHES=(
 	"${FILESDIR}/${PN}-7.1.0-functions.patch"
+	"${FILESDIR}/${PN}-10.1-export-symbols.patch"
 	"${FILESDIR}/kfdtest-6.1.0-skipIPCtest.patch"
 	"${FILESDIR}/kfdtest-6.2.4-fix-llvm-header.patch"
 )