diff options
Diffstat (limited to 'llvm/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp')
-rw-r--r-- | llvm/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/llvm/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp b/llvm/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp index f32a659f727..438c208ad8f 100644 --- a/llvm/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp +++ b/llvm/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp @@ -699,25 +699,15 @@ void X86AsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) { // Handle the zerofill directive on darwin, which is a special form of BSS // emission. - if (GVKind.isBSS() && MAI->hasMachoZeroFillDirective()) { - TargetLoweringObjectFileMachO &TLOFMacho = - static_cast<TargetLoweringObjectFileMachO &>(getObjFileLowering()); - if (TLOFMacho.isDataCommonSection(TheSection)) { - // .globl _foo - OutStreamer.EmitSymbolAttribute(GVarSym, MCStreamer::Global); - // .zerofill __DATA, __common, _foo, 400, 5 - OutStreamer.EmitZerofill(TheSection, GVarSym, Size, 1 << Align); - return; - } + if (GVKind.isBSSExtern() && MAI->hasMachoZeroFillDirective()) { + // .globl _foo + OutStreamer.EmitSymbolAttribute(GVarSym, MCStreamer::Global); + // .zerofill __DATA, __common, _foo, 400, 5 + OutStreamer.EmitZerofill(TheSection, GVarSym, Size, 1 << Align); + return; } - OutStreamer.SwitchSection(TheSection); - - // FIXME: get this stuff from section kind flags. - if (C->isNullValue() && !GVar->hasSection() && - // Don't put things that should go in the cstring section into "comm". - !TheSection->getKind().isMergeableCString() && - !GVar->isThreadLocal() && GVar->hasLocalLinkage()) { + if (GVKind.isBSSLocal()) { if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it. if (const char *LComm = MAI->getLCOMMDirective()) { @@ -742,6 +732,8 @@ void X86AsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) { return; } + OutStreamer.SwitchSection(TheSection); + switch (GVar->getLinkage()) { case GlobalValue::CommonLinkage: case GlobalValue::LinkOnceAnyLinkage: |