[PATCH] D102684: [LLD] Allow disabling the early exit codepath as a build configuration

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 24 12:47:03 PDT 2021


mstorsjo added a comment.

In D102684#2777870 <https://reviews.llvm.org/D102684#2777870>, @amccarth wrote:

> I assumed the short circuit option would just skip running destructors for statics in the DLLs (by having the DLLs do nothing on DLL_PROCESS_DETACH), but I see in the stack trace that it's libc++'s DllMain, which is outside our scope.  Bummer.
>
> Of course, the real mind bender is wondering why the "universal" CRT needs to setjmp (?!) (and therefore allocate memory) during shutdown.  Yikes!

It's not the UCRT itself that needs setjmp during shutdown, it's libc++ that calls `_configthreadlocale` (which IIRC is used to emulate functions that take a locale parameter). Not sure what call it is within libc++ though. The root cause remains in any case - running threads that are abruptly stopped can leave things in an unclean state, and the only really safe way to exit from it is to not let things run destructors.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102684/new/

https://reviews.llvm.org/D102684



More information about the llvm-commits mailing list