[Openmp-commits] [PATCH] D139857: [OpenMP][libomp] Fix macOS 12 library destruction

Jonathan Peyton via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Dec 12 09:37:51 PST 2022

jlpeyton created this revision.
jlpeyton added reviewers: tlwilmar, Nawrin, hbae.
jlpeyton added a project: OpenMP.
Herald added subscribers: guansong, kristof.beyls, yaxunl.
Herald added a project: All.
jlpeyton requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a subscriber: sstefan1.

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+.

  rG LLVM Github Monorepo



Index: openmp/runtime/src/kmp_runtime.cpp
--- openmp/runtime/src/kmp_runtime.cpp
+++ openmp/runtime/src/kmp_runtime.cpp
@@ -7198,10 +7198,12 @@
+#if !KMP_DYNAMIC_LIB ||                                                        \
     /* 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),

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139857.482174.patch
Type: text/x-patch
Size: 821 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20221212/7f0f2856/attachment.bin>

More information about the Openmp-commits mailing list