[all-commits] [llvm/llvm-project] 9487cf: [Support] Restrict ManagedStatic ThreadPoolExecuto...

Fangrui Song via All-commits all-commits at lists.llvm.org
Tue Aug 13 17:02:24 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9487cf97e31bb9fac14394913b64c60ae60f5e41
      https://github.com/llvm/llvm-project/commit/9487cf97e31bb9fac14394913b64c60ae60f5e41
  Author: Fangrui Song <i at maskray.me>
  Date:   2024-08-13 (Tue, 13 Aug 2024)

  Changed paths:
    M llvm/lib/Support/Parallel.cpp

  Log Message:
  -----------
  [Support] Restrict ManagedStatic ThreadPoolExecutor to Windows

https://reviews.llvm.org/D70447 switched to `ManagedStatic` to work
around race conditions in MSVC runtimes and the MinGW runtime.
However, `ManagedStatic` is not suitable for other platforms.

However, this workaround is not suitable for other platforms (#66974).
lld::fatal calls exitLld(1), which calls `llvm_shutdown` to destroy
`ManagedStatic` objects. The worker threads will finish and invoke TLS
destructors (glibc `__call_tls_dtors`). This can lead to race conditions
if other threads attempt to access TLS objects that have already been
destroyed.

While lld's early exit mechanism needs more work, I believe Parallel.cpp
should avoid this pitfall as well.

Pull Request: https://github.com/llvm/llvm-project/pull/102989



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list