[llvm-commits] CVS: llvm/lib/Target/X86/X86AsmPrinter.cpp

Evan Cheng evan.cheng at apple.com
Tue Feb 7 15:33:10 PST 2006



Changes in directory llvm/lib/Target/X86:

X86AsmPrinter.cpp updated: 1.162 -> 1.163
---
Log message:

Fixed a local common symbol bug.


---
Diffs of the changes:  (+17 -11)

 X86AsmPrinter.cpp |   28 +++++++++++++++++-----------
 1 files changed, 17 insertions(+), 11 deletions(-)


Index: llvm/lib/Target/X86/X86AsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.162 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.163
--- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.162	Tue Feb  7 15:54:08 2006
+++ llvm/lib/Target/X86/X86AsmPrinter.cpp	Tue Feb  7 17:32:58 2006
@@ -97,26 +97,29 @@
         (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\", at progbits\n";
@@ -138,8 +141,11 @@
       }
 
       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';
     }






More information about the llvm-commits mailing list