Some functions of asan depends on Atexit() handlers. On Windows, this
is implemented in ad3ec82bb1c7217b0187a1e16bb22642e194ce94 to queue the
handlers in a vector then register them with atexit() only after the
CRT is fully initialized. However, this is broken on MinGW with
asan_dynamic runtime due to different initialization order. This change
fixes the issue by making sure that Atexit() can call atexit()
directly past the pre-initialization phase.
This fixes two asan test cases on MinGW.
So... is the root issue that C++ global constructors are executed after the .CRT$XID initializer in MSVC environments, but before in mingw environments? I believe they're supposed to be compatible, so if there's such a discrepancy, maybe we should also consider trying to fix it in mingw-w64 crt?