[Openmp-commits] [openmp] [OMPD] Runtime Entry Point functions for OMPD in libomp.so need C linkage as per standard. (PR #79246)

via Openmp-commits openmp-commits at lists.llvm.org
Mon Jan 29 02:37:50 PST 2024


https://github.com/vigbalu updated https://github.com/llvm/llvm-project/pull/79246

>From 9c3eb85b9e6959bd7ebb44ab8d98bff11d649a01 Mon Sep 17 00:00:00 2001
From: Vignesh Balasubramanian <Vignesh.Balasubrmanian at amd.com>
Date: Wed, 24 Jan 2024 08:07:39 +0530
Subject: [PATCH] [OMPD] Runtime Entry Point functions for OMPD in libomp.so is
 mangled.

Encapsulating required OMPD and OMPT data structures and signatures within
extern "C" as per the supplementary soure file for omp-tools.h provided by
the OpenMP spec
https://github.com/OpenMP/sources/blob/main/include/omp-tools.h,
thus ensuring that the OMPD runtime entry point functions have C linkage
and are not mangled.
---
 openmp/runtime/src/include/omp-tools.h.var | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/openmp/runtime/src/include/omp-tools.h.var b/openmp/runtime/src/include/omp-tools.h.var
index a3ec0309db18c1..1d1a0f7771e95f 100644
--- a/openmp/runtime/src/include/omp-tools.h.var
+++ b/openmp/runtime/src/include/omp-tools.h.var
@@ -211,6 +211,10 @@ typedef enum kmp_mutex_impl_t {
  * definitions generated from spec
  *****************************************************************************/
 
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
 typedef enum ompt_callbacks_t {
   ompt_callback_thread_begin             = 1,
   ompt_callback_thread_end               = 2,
@@ -1414,4 +1418,8 @@ typedef ompt_record_ompt_t *(*ompt_get_record_ompt_t) (
 
 #define ompd_segment_none 0
 
+#if defined(__cplusplus)
+} // extern "C"
+#endif
+
 #endif /* __OMPT__ */



More information about the Openmp-commits mailing list