From 48f077a7a62ab82ea66a0fb49051d023c4b5f7d3 Mon Sep 17 00:00:00 2001
From: Thomas Fitzsimmons <fitzsim@fitzsim.org>
Date: Sun, 11 Jan 2026 12:07:10 -0500
Subject: [PATCH] rocr: Fix vDSO detection on ppc64 architectures in
 os_linux.cpp

This fixes a segmentation fault:

| $ rocminfo
| ROCk module is loaded
| Segmentation fault
---
 .../runtime/hsa-runtime/core/util/lnx/os_linux.cpp        | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/util/lnx/os_linux.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/util/lnx/os_linux.cpp
index 608676a773..72f096d97e 100644
--- a/projects/rocr-runtime/runtime/hsa-runtime/core/util/lnx/os_linux.cpp
+++ b/projects/rocr-runtime/runtime/hsa-runtime/core/util/lnx/os_linux.cpp
@@ -66,6 +66,12 @@
 #include <cpuid.h>
 #endif
 
+#if defined(__PPC64__)
+#define VDSO_STRING "vdso64.so"
+#else
+#define VDSO_STRING "vdso.so"
+#endif
+
 #ifdef __GLIBC__
 #define ABS_ADDR(base, ptr) (ptr)
 #else
@@ -326,7 +332,7 @@ static int callback(struct dl_phdr_info* info, size_t size, void* data) {
    */
 
   if ((info) && (info->dlpi_name[0] != '\0')) {
-    if (std::string(info->dlpi_name).find("vdso.so") != std::string::npos) return 0;
+    if (std::string(info->dlpi_name).find(VDSO_STRING) != std::string::npos) return 0;
 
     /*
      * Iterate through the program headers of the loaded lib and check for PT_DYNAMIC program
-- 
2.47.3

