From 687ed48c6e19c5ef6e8f7b3a2bf5fa82bb12ce23 Mon Sep 17 00:00:00 2001 From: Gaurav Chaudhari Date: Thu, 25 Apr 2024 08:25:28 -0700 Subject: [PATCH] Open XL segfault fix and workaround for si.cpp macro collision The omrthread_get_ras_tid() function in rasthrsup.c was causing a segmentation fault with Open XL as pthread_t is structured in a different manner. This fixes that while keeping support with XLC. The header grp.h used in si.cpp also has a macro collision with the native locale header from Open XL. The reordering of headers is a workaround for the core problem. A issue has also been created in order to use a better macro name __grp. --- fvtest/porttest/si.cpp | 1 + thread/zos390/rasthrsup.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/fvtest/porttest/si.cpp b/fvtest/porttest/si.cpp index 3ef499b2eb..8ba88b4bbd 100644 --- a/fvtest/porttest/si.cpp +++ b/fvtest/porttest/si.cpp @@ -42,6 +42,7 @@ #include #endif /* defined(OMR_OS_WINDOWS) */ #if !defined(OMR_OS_WINDOWS) +#include #include #include #if defined(J9ZOS390) diff --git a/thread/zos390/rasthrsup.c b/thread/zos390/rasthrsup.c index a487694916..bd6a5887fa 100644 --- a/thread/zos390/rasthrsup.c +++ b/thread/zos390/rasthrsup.c @@ -26,5 +26,6 @@ uintptr_t omrthread_get_ras_tid(void) { - return (uintptr_t)(*(uint32_t *)pthread_self().__); + pthread_t id = pthread_self(); + return (uintptr_t)*(unsigned long long *)&id; }