Skip to content

Commit 0aa5aeb

Browse files
author
Jonathan Peyton
committed
[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
1 parent 4a64024 commit 0aa5aeb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

openmp/runtime/src/kmp_runtime.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7242,10 +7242,12 @@ static void __kmp_do_serial_initialize(void) {
72427242
__kmp_register_atfork();
72437243
#endif
72447244

7245-
#if !KMP_DYNAMIC_LIB
7245+
#if !KMP_DYNAMIC_LIB || \
7246+
((KMP_COMPILER_ICC || KMP_COMPILER_ICX) && KMP_OS_DARWIN)
72467247
{
72477248
/* Invoke the exit handler when the program finishes, only for static
7248-
library. For dynamic library, we already have _fini and DllMain. */
7249+
library and macOS* dynamic. For other dynamic libraries, we already
7250+
have _fini and DllMain. */
72497251
int rc = atexit(__kmp_internal_end_atexit);
72507252
if (rc != 0) {
72517253
__kmp_fatal(KMP_MSG(FunctionError, "atexit()"), KMP_ERR(rc),

0 commit comments

Comments
 (0)