mirror of
https://github.com/clang-retro/llvm.git
synced 2026-11-28 13:19:18 -08:00
Libomp is calling libomptarget `finalizeLibrary` as part of its `atexit` tear-down process. But because the order of library dependencies, libomptarget deinitializes first so when `finalizeLibrary` is called, calling even a simple `ODBG` (with debug enabled) results in a segfault because the stream has already been destructed. In this PR, we ensure that OMPT is disconnected (in libomptarget) at deinit at the latest and avoid doing that again if recalled from libomp. Also, the LibraryFinalizer was never used (and in any case it should be called before olShutDown) so simplify the disconnect to the minimum.