[all-commits] [llvm/llvm-project] a54b6b: [sanitizer][win] Fix `Atexit()` on MinGW asan_dyna...

alvinhochun via All-commits all-commits at lists.llvm.org
Mon Apr 10 08:21:51 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a54b6b33184ffa8e1c127029edf6b857b8199ea1
      https://github.com/llvm/llvm-project/commit/a54b6b33184ffa8e1c127029edf6b857b8199ea1
  Author: Alvin Wong <alvin at alvinhc.com>
  Date:   2023-04-10 (Mon, 10 Apr 2023)

  Changed paths:
    M compiler-rt/lib/sanitizer_common/sanitizer_win.cpp
    M compiler-rt/test/asan/TestCases/Windows/coverage-basic.cpp
    M compiler-rt/test/asan/TestCases/atexit_stats.cpp

  Log Message:
  -----------
  [sanitizer][win] Fix `Atexit()` on MinGW asan_dynamic runtime

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.

Differential Revision: https://reviews.llvm.org/D147413


  Commit: 26c57df8aa3b3a134bbda3a4e3ab34625ffc7510
      https://github.com/llvm/llvm-project/commit/26c57df8aa3b3a134bbda3a4e3ab34625ffc7510
  Author: Alvin Wong <alvin at alvinhc.com>
  Date:   2023-04-10 (Mon, 10 Apr 2023)

  Changed paths:
    M compiler-rt/test/asan/TestCases/global-location-nodebug.cpp
    M compiler-rt/test/asan/TestCases/heavy_uar_test.cpp

  Log Message:
  -----------
  [asan][test] Fix two test cases on Windows

Fixes global-location-nodebug and heavy_uar_test for both MSVC and MinGW
targets.

Differential Revision: https://reviews.llvm.org/D147445


Compare: https://github.com/llvm/llvm-project/compare/225d255a583e...26c57df8aa3b


More information about the All-commits mailing list