Fixed a local common symbol bug.
authorEvan Cheng <evan.cheng@apple.com>
Tue, 7 Feb 2006 23:32:58 +0000 (23:32 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Tue, 7 Feb 2006 23:32:58 +0000 (23:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26044 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86AsmPrinter.cpp

index 1b05691a0be181df961123ed72c0a4b689e31ef7..79bf17f08439d283b5e06d497badeb0aebbb51a5 100644 (file)
@@ -97,26 +97,29 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
         (I->hasInternalLinkage() || I->hasWeakLinkage() ||
          I->hasLinkOnceLinkage())) {
       if (Size == 0) Size = 1;   // .comm Foo, 0 is undefined, avoid it.
-      if (forDarwin) {
-        SwitchSection(".data", I);
-        if (I->hasInternalLinkage())
-          O << LCOMMDirective << name << "," << Size << "," << Align;
-        else
+      SwitchSection(".data", I);
+      if (LCOMMDirective != NULL) {
+        if (I->hasInternalLinkage()) {
+          O << LCOMMDirective << name << "," << Size;
+          if (forDarwin)
+            O << "," << (AlignmentIsInBytes ? (1 << Align) : Align);
+        } else
           O << COMMDirective  << name << "," << Size;
       } else {
-        SwitchSection(".local", I);
+        if (I->hasInternalLinkage())
+          O <<"\t.local\t" << name << "\n";
         O << COMMDirective  << name << "," << Size;
         if (COMMDirectiveTakesAlignment)
           O << "," << (AlignmentIsInBytes ? (1 << Align) : Align);
       }
-      O << "\t\t" << CommentString << " '" << I->getName() << "'\n";
+      O << "\t\t" << CommentString << " " << I->getName() << "\n";
     } else {
       switch (I->getLinkage()) {
       case GlobalValue::LinkOnceLinkage:
       case GlobalValue::WeakLinkage:
         if (forDarwin) {
-          O << "\t.globl " << name << '\n'
-            << "\t.weak_definition " << name << '\n';
+          O << "\t.globl " << name << "\n"
+            << "\t.weak_definition " << name << "\n";
           SwitchSection(".section __DATA,__datacoal_nt,coalesced", I);
         } else {
           O << "\t.section\t.llvm.linkonce.d." << name << ",\"aw\",@progbits\n";
@@ -138,8 +141,11 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
       }
 
       EmitAlignment(Align, I);
-      O << name << ":\t\t\t\t" << CommentString << " '" << I->getName()
-        << "'\n";
+      O << name << ":\t\t\t\t" << CommentString << " " << I->getName()
+        << "\n";
+      if (HasDotTypeDotSizeDirective)
+        O << "\t.size " << name << ", " << Size << "\n";
+
       EmitGlobalConstant(C);
       O << '\n';
     }