[PATCH] D53968: [LLD]fix windows mingw build with 'LLVM_LINK_LLVM_DYLIB' the lld will hang when exiting

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 1 13:21:47 PDT 2018


mstorsjo added a comment.

I _think_ this isn't mingw specific, but I don't often do MSVC based builds...

However, I think I have run into this issue before, in a different setup. When exiting lld, we exit by calling `llvm_shutdown(); _exit(Val);` - as this is supposed not to run destructors. At some point I had a broken setup with global destructors, so they ran even when `_exit()` was called, and I ran into a hang with that. I just fixed that by fixing the mingw global destructors to not run on `_exit()`.

However, in the case reported here, if built with `LLVM_LINK_LLVM_DYLIB` enabled, the global destructors (from this object here) are in a different DLL. When exiting the process with `_exit()`, global destructors in other DLLs actually do run - both with mingw and MSVC builds.

I never did dig into the matter any further back then, so I can't confirm/deny the explanation in this post (which is a bit hard to follow), but I would guess that you can try to reproduce the same issue by changing `_exit()` to `exit()` in LLD, and try running LLD in a normal windows build - I think it could be reproducible in MSVC style builds as well.


Repository:
  rL LLVM

https://reviews.llvm.org/D53968





More information about the llvm-commits mailing list