Author: hans Date: Fri Jan 18 01:32:52 2019 New Revision: 351533 URL: http://llvm.org/viewvc/llvm-project?rev=351533&view=rev Log: Merging r351457: ------------------------------------------------------------------------ r351457 | vlad.tsyrklevich | 2019-01-17 18:53:45 +0100 (Thu, 17 Jan 2019) | 15 lines
TLS: Respect visibility for thread_local variables on Darwin (PR40327) Summary: Teach clang to mark thread wrappers for thread_local variables with hidden visibility when the original variable is marked with hidden visibility. This is necessary on Darwin which exposes the thread wrapper instead of the thread variable. The thread wrapper would previously always be created with default visibility unless it had linkonce*/weak_odr linkage. Reviewers: rjmccall Reviewed By: rjmccall Differential Revision: https://reviews.llvm.org/D56818 ------------------------------------------------------------------------ Added: cfe/branches/release_80/test/CodeGenCXX/cxx11-thread-local-visibility.cpp - copied unchanged from r351457, cfe/trunk/test/CodeGenCXX/cxx11-thread-local-visibility.cpp Modified: cfe/branches/release_80/ (props changed) cfe/branches/release_80/lib/CodeGen/ItaniumCXXABI.cpp cfe/branches/release_80/test/CodeGenCXX/cxx11-thread-local.cpp Propchange: cfe/branches/release_80/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Fri Jan 18 01:32:52 2019 @@ -1,4 +1,4 @@ /cfe/branches/type-system-rewrite:134693-134817 -/cfe/trunk:351334,351340,351344,351360 +/cfe/trunk:351334,351340,351344,351360,351457 /cfe/trunk/test:170344 /cfe/trunk/test/SemaTemplate:126920 Modified: cfe/branches/release_80/lib/CodeGen/ItaniumCXXABI.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_80/lib/CodeGen/ItaniumCXXABI.cpp?rev=351533&r1=351532&r2=351533&view=diff ============================================================================== --- cfe/branches/release_80/lib/CodeGen/ItaniumCXXABI.cpp (original) +++ cfe/branches/release_80/lib/CodeGen/ItaniumCXXABI.cpp Fri Jan 18 01:32:52 2019 @@ -2463,10 +2463,12 @@ ItaniumCXXABI::getOrCreateThreadLocalWra CGM.SetLLVMFunctionAttributesForDefinition(nullptr, Wrapper); // Always resolve references to the wrapper at link time. - if (!Wrapper->hasLocalLinkage() && !(isThreadWrapperReplaceable(VD, CGM) && - !llvm::GlobalVariable::isLinkOnceLinkage(Wrapper->getLinkage()) && - !llvm::GlobalVariable::isWeakODRLinkage(Wrapper->getLinkage()))) - Wrapper->setVisibility(llvm::GlobalValue::HiddenVisibility); + if (!Wrapper->hasLocalLinkage()) + if (!isThreadWrapperReplaceable(VD, CGM) || + llvm::GlobalVariable::isLinkOnceLinkage(Wrapper->getLinkage()) || + llvm::GlobalVariable::isWeakODRLinkage(Wrapper->getLinkage()) || + VD->getVisibility() == HiddenVisibility) + Wrapper->setVisibility(llvm::GlobalValue::HiddenVisibility); if (isThreadWrapperReplaceable(VD, CGM)) { Wrapper->setCallingConv(llvm::CallingConv::CXX_FAST_TLS); Modified: cfe/branches/release_80/test/CodeGenCXX/cxx11-thread-local.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_80/test/CodeGenCXX/cxx11-thread-local.cpp?rev=351533&r1=351532&r2=351533&view=diff ============================================================================== --- cfe/branches/release_80/test/CodeGenCXX/cxx11-thread-local.cpp (original) +++ cfe/branches/release_80/test/CodeGenCXX/cxx11-thread-local.cpp Fri Jan 18 01:32:52 2019 @@ -318,7 +318,7 @@ void set_anon_i() { // CHECK-NOT: call void @[[V_M_INIT]]() -// LIUNX: define weak_odr hidden i32* @_ZTW1a() { +// LINUX: define weak_odr hidden i32* @_ZTW1a() // DARWIN: define cxx_fast_tlscc i32* @_ZTW1a() // LINUX: call void @_ZTH1a() // DARWIN: call cxx_fast_tlscc void @_ZTH1a() _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits