[llvm-commits] [llvm] r51527 - /llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp

Dale Johannesen dalej at apple.com
Fri May 23 17:10:20 PDT 2008


Author: johannes
Date: Fri May 23 19:10:20 2008
New Revision: 51527

URL: http://llvm.org/viewvc/llvm-project?rev=51527&view=rev
Log:
Put initialized const weak objects into correct
sections on ppc32 darwin.  g++.dg/abi/key2.C


Modified:
    llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp

Modified: llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp?rev=51527&r1=51526&r2=51527&view=diff

==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp Fri May 23 19:10:20 2008
@@ -977,7 +977,15 @@
       case GlobalValue::CommonLinkage:
         O << "\t.globl " << name << '\n'
           << "\t.weak_definition " << name << '\n';
-        SwitchToDataSection("\t.section __DATA,__datacoal_nt,coalesced", I);
+        if (!I->isConstant())
+          SwitchToDataSection("\t.section __DATA,__datacoal_nt,coalesced", I);
+        else {
+          const ArrayType *AT = dyn_cast<ArrayType>(Type);
+          if (AT && AT->getElementType()==Type::Int8Ty)
+            SwitchToDataSection("\t.section __TEXT,__const_coal,coalesced", I);
+          else
+            SwitchToDataSection("\t.section __DATA,__const_coal,coalesced", I);
+        }
         break;
       case GlobalValue::AppendingLinkage:
         // FIXME: appending linkage variables should go into a section of





More information about the llvm-commits mailing list