[all-commits] [llvm/llvm-project] e28094: [Support] Access threadIndex via a wrapper function

Martin Storsjö via All-commits all-commits at lists.llvm.org
Tue Sep 13 23:30:04 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e280940bfb33eb21925b0b13f04e3b87289b9dea
      https://github.com/llvm/llvm-project/commit/e280940bfb33eb21925b0b13f04e3b87289b9dea
  Author: Martin Storsjö <martin at martin.st>
  Date:   2022-09-14 (Wed, 14 Sep 2022)

  Changed paths:
    M lld/ELF/Relocations.cpp
    M lld/ELF/SyntheticSections.h
    M llvm/include/llvm/Support/Parallel.h
    M llvm/lib/Support/Parallel.cpp

  Log Message:
  -----------
  [Support] Access threadIndex via a wrapper function

On Unix platforms, this wrapper function is inline, so it should
expand to the same direct access to the thread local variable. On
Windows, it's a non-inline function within Parallel.cpp, allowing
making the thread_local variable static.

Windows Native TLS doesn't support direct access to thread local
variables in a different DLL, and GCC/binutils on Windows occasionally
has problems with non-static thread local variables too.

This fixes mingw dylib builds with native TLS after
e6aebff67426fa0f9779a0c19d6188a043bf15e7.

At the same time, move the whole thread local variable within
    #if LLVM_ENABLE_THREADS
to fix builds without threading support.

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




More information about the All-commits mailing list