[PATCH] D147413: [sanitizer][win] Fix `Atexit()` on MinGW asan_dynamic runtime

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 2 14:48:16 PDT 2023


mstorsjo added inline comments.


================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_win.cpp:731
+// On this environment, __asan_init is called during global constructor phase,
+// way after calling the .CRT$XID initializer.
+static int (*volatile queueOrCallAtExit)(void (*)(void)) = &queueAtexit;
----------------
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?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147413



More information about the llvm-commits mailing list