Fixed a local common symbol bug.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26044 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng 2006-02-07 23:32:58 +00:00
parent 315421e77c
commit 5ada370f42

View File

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