[Openmp-commits] [openmp] 0aa5aeb - [OpenMP][libomp] Fix macOS 12 library destruction
Jonathan Peyton via Openmp-commits
openmp-commits at lists.llvm.org
Mon Jan 16 20:43:12 PST 2023
Author: Jonathan Peyton
Date: 2023-01-16T22:42:18-06:00
New Revision: 0aa5aebd0ace94cfb6b975b16024fe90a6139acf
URL: https://github.com/llvm/llvm-project/commit/0aa5aebd0ace94cfb6b975b16024fe90a6139acf
DIFF: https://github.com/llvm/llvm-project/commit/0aa5aebd0ace94cfb6b975b16024fe90a6139acf.diff
LOG: [OpenMP][libomp] Fix macOS 12 library destruction
When building the library with icc and using it on macOS 12,
the library destruction process is skipped which has many OMPT tests
failing for macOS 12. This change registers the
__kmp_internal_end_library() call for atexit() which will be a
harmless, redundant call for macOS 11 and below and the only destructor
called for macOS 12+.
Differential Revision: https://reviews.llvm.org/D139857
Added:
Modified:
openmp/runtime/src/kmp_runtime.cpp
Removed:
################################################################################
diff --git a/openmp/runtime/src/kmp_runtime.cpp b/openmp/runtime/src/kmp_runtime.cpp
index e70393a910085..6022dcad99acd 100644
--- a/openmp/runtime/src/kmp_runtime.cpp
+++ b/openmp/runtime/src/kmp_runtime.cpp
@@ -7242,10 +7242,12 @@ static void __kmp_do_serial_initialize(void) {
__kmp_register_atfork();
#endif
-#if !KMP_DYNAMIC_LIB
+#if !KMP_DYNAMIC_LIB || \
+ ((KMP_COMPILER_ICC || KMP_COMPILER_ICX) && KMP_OS_DARWIN)
{
/* Invoke the exit handler when the program finishes, only for static
- library. For dynamic library, we already have _fini and DllMain. */
+ library and macOS* dynamic. For other dynamic libraries, we already
+ have _fini and DllMain. */
int rc = atexit(__kmp_internal_end_atexit);
if (rc != 0) {
__kmp_fatal(KMP_MSG(FunctionError, "atexit()"), KMP_ERR(rc),
More information about the Openmp-commits
mailing list