diff options
author | Evan Cheng <evan.cheng@apple.com> | 2006-02-15 01:56:23 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2006-02-15 01:56:23 +0000 |
commit | 17ef92eda77809c87c5dc006b85be87a9e9a84dc (patch) | |
tree | dba8093cb733a37d3ac0c57fca4d0211945c9597 | |
parent | c080d6fb3dc7769c5a1e00c6a77cb415453b0b89 (diff) |
Use .zerofill on x86/darwin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26196 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/X86/X86AsmPrinter.cpp | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/lib/Target/X86/X86AsmPrinter.cpp b/lib/Target/X86/X86AsmPrinter.cpp index 7de9ef2b5f..5a43f867fd 100644 --- a/lib/Target/X86/X86AsmPrinter.cpp +++ b/lib/Target/X86/X86AsmPrinter.cpp @@ -96,24 +96,31 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) { if (C->isNullValue() && /* FIXME: Verify correct */ (I->hasInternalLinkage() || I->hasWeakLinkage() || - I->hasLinkOnceLinkage())) { + I->hasLinkOnceLinkage() || + (forDarwin && I->hasExternalLinkage() && !I->hasSection()))) { if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it. - 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; + if (I->hasExternalLinkage()) { + O << "\t.global\t" << name << "\n"; + O << "\t.zerofill __DATA__, __common, " << name << ", " + << Size << ", " << Align; } else { - if (I->hasInternalLinkage()) - O <<"\t.local\t" << name << "\n"; - O << COMMDirective << name << "," << Size; - if (COMMDirectiveTakesAlignment) - O << "," << (AlignmentIsInBytes ? (1 << Align) : Align); + 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 { + 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: |