[PATCH] D80417: Fix Darwin 'constinit thread_local' variables.

James Y Knight via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 21 16:49:04 PDT 2020


jyknight created this revision.
jyknight added a reviewer: rjmccall.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Unlike other platforms using ItaniumCXXABI, Darwin does not allow the
creation of a thread-wrapper function for a variable in the TU of
users. Because of this, it can set the linkage of the thread-local
symbol to internal, with the assumption that no TUs other than the one
defining the variable will need it.

However, constinit thread_local variables do not require the use of
the thread-wrapper call, so users reference the variable
directly. Thus, it must not be converted to internal.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80417

Files:
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/test/CodeGenCXX/cxx2a-thread-local-constinit.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80417.265642.patch
Type: text/x-patch
Size: 5733 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200521/7bd74ea9/attachment.bin>


More information about the cfe-commits mailing list