[cfe-commits] r110530 - in /cfe/trunk: lib/CodeGen/CodeGenModule.cpp test/CodeGen/thread-specifier.c

Eric Christopher echristo at apple.com
Sat Aug 7 18:37:14 PDT 2010


Author: echristo
Date: Sat Aug  7 20:37:14 2010
New Revision: 110530

URL: http://llvm.org/viewvc/llvm-project?rev=110530&view=rev
Log:
Thread local variables aren't considered common linkage.

Modified:
    cfe/trunk/lib/CodeGen/CodeGenModule.cpp
    cfe/trunk/test/CodeGen/thread-specifier.c

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=110530&r1=110529&r2=110530&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Sat Aug  7 20:37:14 2010
@@ -1201,7 +1201,8 @@
     GV->setLinkage(llvm::GlobalVariable::WeakAnyLinkage);   
   else if (!getLangOptions().CPlusPlus && !CodeGenOpts.NoCommon &&
            !D->hasExternalStorage() && !D->getInit() &&
-           !D->getAttr<SectionAttr>()) {
+           !D->getAttr<SectionAttr>() && !D->isThreadSpecified()) {
+    // Thread local vars aren't considered common linkage.
     GV->setLinkage(llvm::GlobalVariable::CommonLinkage);
     // common vars aren't constant even if declared const.
     GV->setConstant(false);

Modified: cfe/trunk/test/CodeGen/thread-specifier.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/thread-specifier.c?rev=110530&r1=110529&r2=110530&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/thread-specifier.c (original)
+++ cfe/trunk/test/CodeGen/thread-specifier.c Sat Aug  7 20:37:14 2010
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -triple i686-pc-linux-gnu -emit-llvm -o - %s | grep thread_local | count 4
+// RUN: %clang_cc1 -triple i686-pc-linux-gnu -emit-llvm -o - %s | not grep common
 
 __thread int a;
 extern __thread int b;





More information about the cfe-commits mailing list