[all-commits] [llvm/llvm-project] aca3d0: Fix Darwin 'constinit thread_local' variables.

James Y Knight via All-commits all-commits at lists.llvm.org
Wed May 27 09:00:13 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: aca3d067efe194539efd1e0fcf03820a2c377753
      https://github.com/llvm/llvm-project/commit/aca3d067efe194539efd1e0fcf03820a2c377753
  Author: James Y Knight <jyknight at google.com>
  Date:   2020-05-27 (Wed, 27 May 2020)

  Changed paths:
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/test/CodeGenCXX/cxx2a-thread-local-constinit.cpp

  Log Message:
  -----------
  Fix Darwin 'constinit thread_local' variables.

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, or users will
get a link failure.

This was a regression introduced by the optimization in
00223827a952f66e7426c9881a2a4229e59bb019.

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




More information about the All-commits mailing list