[Openmp-commits] [openmp] fef73b8 - [OpenMP][libomp] Cleanup version script and exported symbols
Jonathan Peyton via Openmp-commits
openmp-commits at lists.llvm.org
Tue Dec 6 06:34:13 PST 2022
Author: Jonathan Peyton
Date: 2022-12-06T08:33:31-06:00
New Revision: fef73b81e9a742c4db61ded747c801e3717dae78
URL: https://github.com/llvm/llvm-project/commit/fef73b81e9a742c4db61ded747c801e3717dae78
DIFF: https://github.com/llvm/llvm-project/commit/fef73b81e9a742c4db61ded747c801e3717dae78.diff
LOG: [OpenMP][libomp] Cleanup version script and exported symbols
This patch fixes issues seen once https://reviews.llvm.org/D135402 is applied.
The exports_so.txt file attempts to export functions which may not exist
depending on which features are enabled/disabled in the OpenMP
runtime library. There are not many of these so exporting dummy
symbols is feasible.
* Export dummy __kmp_reset_stats() function when stats is disabled.
* Export dummy debugging data when USE_DEBUGGER is disabled
* Export dummy __kmp_itt_[fini|init]_ittlib() functions
when ITT Notify is disabled
* Export dummy __kmp_reap_monitor() function when KMP_USE_MONITOR
is disabled
* Remove __kmp_launch_monitor and __kmp_launch_worker from being exported.
They have been static symbols since library inception.
Fixes: https://github.com/llvm/llvm-project/issues/58858
Differential Revision: https://reviews.llvm.org/D138049
Added:
Modified:
openmp/runtime/src/exports_so.txt
openmp/runtime/src/kmp_runtime.cpp
openmp/runtime/src/z_Linux_util.cpp
Removed:
################################################################################
diff --git a/openmp/runtime/src/exports_so.txt b/openmp/runtime/src/exports_so.txt
index 683f3efdf5391..124c80a1422b4 100644
--- a/openmp/runtime/src/exports_so.txt
+++ b/openmp/runtime/src/exports_so.txt
@@ -72,10 +72,8 @@ VERSION {
__kmp_fork_call;
__kmp_invoke_microtask;
#if KMP_USE_MONITOR
- __kmp_launch_monitor;
__kmp_reap_monitor;
#endif
- __kmp_launch_worker;
__kmp_reap_worker;
__kmp_release_64;
__kmp_wait_64;
diff --git a/openmp/runtime/src/kmp_runtime.cpp b/openmp/runtime/src/kmp_runtime.cpp
index 0e9c9a697ec0a..a2fefafda7383 100644
--- a/openmp/runtime/src/kmp_runtime.cpp
+++ b/openmp/runtime/src/kmp_runtime.cpp
@@ -9195,3 +9195,20 @@ void __kmp_set_nesting_mode_threads() {
if (__kmp_nesting_mode == 1) // turn on nesting for this case only
set__max_active_levels(thread, __kmp_nesting_mode_nlevels);
}
+
+// Empty symbols to export (see exports_so.txt) when feature is disabled
+extern "C" {
+#if !KMP_STATS_ENABLED
+void __kmp_reset_stats() {}
+#endif
+#if !USE_DEBUGGER
+int __kmp_omp_debug_struct_info = FALSE;
+int __kmp_debugging = FALSE;
+#endif
+#if !USE_ITT_BUILD || !USE_ITT_NOTIFY
+void __kmp_itt_fini_ittlib() {}
+void __kmp_itt_init_ittlib() {}
+#endif
+}
+
+// end of file
diff --git a/openmp/runtime/src/z_Linux_util.cpp b/openmp/runtime/src/z_Linux_util.cpp
index 7aa704b0a49b0..b1525a3687ad8 100644
--- a/openmp/runtime/src/z_Linux_util.cpp
+++ b/openmp/runtime/src/z_Linux_util.cpp
@@ -979,7 +979,7 @@ void __kmp_exit_thread(int exit_status) {
#if KMP_USE_MONITOR
void __kmp_resume_monitor();
-void __kmp_reap_monitor(kmp_info_t *th) {
+extern "C" void __kmp_reap_monitor(kmp_info_t *th) {
int status;
void *exit_val;
@@ -1021,6 +1021,12 @@ void __kmp_reap_monitor(kmp_info_t *th) {
KMP_MB(); /* Flush all pending memory write invalidates. */
}
+#else
+// Empty symbol to export (see exports_so.txt) when
+// monitor thread feature is disabled
+extern "C" void __kmp_reap_monitor(kmp_info_t *th) {
+ (void)th;
+}
#endif // KMP_USE_MONITOR
void __kmp_reap_worker(kmp_info_t *th) {
More information about the Openmp-commits
mailing list