[Openmp-commits] [openmp] df9a90c - [OpenMP][test] Define print_possible_return_addresses on SPARC (#138523)

via Openmp-commits openmp-commits at lists.llvm.org
Thu May 15 05:31:59 PDT 2025


Author: Rainer Orth
Date: 2025-05-15T14:31:55+02:00
New Revision: df9a90cdc5d6a74a183e0c1a77bd7fceacf1df0c

URL: https://github.com/llvm/llvm-project/commit/df9a90cdc5d6a74a183e0c1a77bd7fceacf1df0c
DIFF: https://github.com/llvm/llvm-project/commit/df9a90cdc5d6a74a183e0c1a77bd7fceacf1df0c.diff

LOG: [OpenMP][test] Define print_possible_return_addresses on SPARC (#138523)

Parts of the `openmp` testsuite currently don't build on SPARC due to
the lack of a `print_possible_return_addresses` definition.

This patch provides one. With it, the vast majority of tests `PASS` on
Solaris/sparcv9 and, with an additional patch, on Linux/sparc64.

The current definition was obtained empirically.

Tested on `sparcv9-sun-solaris2.11`, `sparc64-unknown-linux-gnu`,
`amd64-pc-solaris2.11`, and `x86_64-pc-linux-gnu`.

Added: 
    

Modified: 
    openmp/runtime/test/ompt/callback.h

Removed: 
    


################################################################################
diff  --git a/openmp/runtime/test/ompt/callback.h b/openmp/runtime/test/ompt/callback.h
index 4dd1db4c4225b..0837cc5dfefcd 100644
--- a/openmp/runtime/test/ompt/callback.h
+++ b/openmp/runtime/test/ompt/callback.h
@@ -311,6 +311,14 @@ ompt_label_##id:
   printf("%" PRIu64 ": current_address=%p or %p or %p\n",                      \
          ompt_get_thread_data()->value, ((char *)addr) - 2,                    \
          ((char *)addr) - 8, ((char *)addr) - 12)
+#elif KMP_ARCH_SPARC
+// FIXME: Need to distinguish between 32 and 64-bit SPARC?
+// On SPARC the NOP instruction is 4 bytes long.
+// FIXME: Explain.  Can use __builtin_frob_return_addr?
+#define print_possible_return_addresses(addr)                                  \
+  printf("%" PRIu64 ": current_address=%p or %p\n",                            \
+         ompt_get_thread_data()->value, ((char *)addr) - 12,                   \
+         (char *)addr - 20)
 #else
 #error Unsupported target architecture, cannot determine address offset!
 #endif


        


More information about the Openmp-commits mailing list