if (C->isNullValue() && !GVar->hasSection() && !GVar->isThreadLocal() &&
// Don't put things that should go in the cstring section into "comm".
!TheSection->getKind().isMergeableCString() &&
- (GVar->hasLocalLinkage() || GVar->isWeakForLinker())) {
+ (GVar->hasLocalLinkage() || GVar->hasLocalLinkage())) {
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
if (isDarwin) {
- if (GVar->hasLocalLinkage()) {
- O << MAI->getLCOMMDirective() << *GVarSym << ',' << Size
- << ',' << Align;
- } else if (GVar->hasCommonLinkage()) {
- O << MAI->getCOMMDirective() << *GVarSym << ',' << Size
- << ',' << Align;
- } else {
- OutStreamer.SwitchSection(TheSection);
- O << "\t.globl " << *GVarSym << '\n' << MAI->getWeakDefDirective();
- O << *GVarSym << '\n';
- EmitAlignment(Align, GVar);
- O << *GVarSym << ":";
- if (VerboseAsm) {
- O.PadToColumn(MAI->getCommentColumn());
- O << MAI->getCommentString() << ' ';
- WriteAsOperand(O, GVar, /*PrintType=*/false, GVar->getParent());
- }
- O << '\n';
- EmitGlobalConstant(C);
- return;
- }
+ O << MAI->getLCOMMDirective() << *GVarSym << ',' << Size
+ << ',' << Align;
} else if (MAI->getLCOMMDirective() != NULL) {
- if (GVar->hasLocalLinkage()) {
- O << MAI->getLCOMMDirective() << *GVarSym << "," << Size;
- } else {
- O << MAI->getCOMMDirective() << *GVarSym << "," << Size;
- if (MAI->getCOMMDirectiveTakesAlignment())
- O << ',' << (MAI->getAlignmentIsInBytes() ? (1 << Align) : Align);
- }
+ O << MAI->getLCOMMDirective() << *GVarSym << "," << Size;
} else {
if (GVar->hasLocalLinkage())
O << "\t.local\t" << *GVarSym << '\n';
OutStreamer.SwitchSection(getObjFileLowering().
SectionForGlobal(GVar, GVKind, Mang, TM));
- if (C->isNullValue() && /* FIXME: Verify correct */
- !GVar->hasSection() &&
- (GVar->hasLocalLinkage() || GVar->hasExternalLinkage() ||
- GVar->isWeakForLinker())) {
+ if (C->isNullValue() && !GVar->hasSection() && GVar->hasLocalLinkage()) {
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
- if (GVar->hasExternalLinkage()) {
- O << "\t.global " << *GVarSym << '\n';
- O << "\t.type " << *GVarSym << ", @object\n";
- O << *GVarSym << ":\n";
- O << "\t.zero " << Size << '\n';
- } else if (GVar->hasLocalLinkage()) {
- O << MAI->getLCOMMDirective() << *GVarSym << ',' << Size;
- } else {
- O << ".comm " << *GVarSym << ',' << Size;
- }
+ O << MAI->getLCOMMDirective() << *GVarSym << ',' << Size;
+
if (VerboseAsm) {
O << "\t\t" << MAI->getCommentString() << " '";
WriteAsOperand(O, GVar, /*PrintType=*/false, GVar->getParent());
/// FIXME: Drive this off the section!
if (C->isNullValue() && /* FIXME: Verify correct */
- !GVar->hasSection() &&
- (GVar->hasLocalLinkage() || GVar->hasExternalLinkage() ||
- GVar->isWeakForLinker()) &&
+ !GVar->hasSection() && GVar->hasLocalLinkage() &&
// Don't put things that should go in the cstring section into "comm".
!TheSection->getKind().isMergeableCString()) {
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
- if (GVar->hasLocalLinkage()) {
- O << MAI->getLCOMMDirective() << *GVarSym << ',' << Size << ',' << Align;
-
- if (VerboseAsm) {
- O << "\t\t" << MAI->getCommentString() << " '";
- WriteAsOperand(O, GVar, /*PrintType=*/false, GVar->getParent());
- O << "'";
- }
- O << '\n';
- } else {
- O << "\t.globl " << *GVarSym << '\n' << MAI->getWeakDefDirective();
- O << *GVarSym << '\n';
- EmitAlignment(Align, GVar);
- O << *GVarSym << ":";
- if (VerboseAsm) {
- O << "\t\t\t\t" << MAI->getCommentString() << " ";
- WriteAsOperand(O, GVar, /*PrintType=*/false, GVar->getParent());
- }
- O << '\n';
- EmitGlobalConstant(C);
+ O << MAI->getLCOMMDirective() << *GVarSym << ',' << Size << ',' << Align;
+
+ if (VerboseAsm) {
+ O << "\t\t" << MAI->getCommentString() << " '";
+ WriteAsOperand(O, GVar, /*PrintType=*/false, GVar->getParent());
+ O << "'";
}
+ O << '\n';
return;
}
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())) {
+ !GVar->isThreadLocal() && GVar->hasLocalLinkage()) {
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
if (const char *LComm = MAI->getLCOMMDirective()) {
O << LComm << *GVarSym << ',' << Size;
if (Subtarget->isTargetDarwin())
O << ',' << Align;
- } else if (Subtarget->isTargetDarwin()) {
- OutStreamer.EmitSymbolAttribute(GVarSym, MCStreamer::Global);
- O << MAI->getWeakDefDirective() << *GVarSym << '\n';
- EmitAlignment(Align, GVar);
- O << *GVarSym << ":";
- if (VerboseAsm) {
- O.PadToColumn(MAI->getCommentColumn());
- O << MAI->getCommentString() << ' ';
- WriteAsOperand(O, GVar, /*PrintType=*/false, GVar->getParent());
- }
- O << '\n';
- EmitGlobalConstant(C);
- return;
- } else {
- O << MAI->getCOMMDirective() << *GVarSym << ',' << Size;
- if (MAI->getCOMMDirectiveTakesAlignment())
- O << ',' << (MAI->getAlignmentIsInBytes() ? (1 << Align) : Align);
}
} else {
- if (!Subtarget->isTargetCygMing()) {
- if (GVar->hasLocalLinkage())
- O << "\t.local\t" << *GVarSym << '\n';
- }
+ if (!Subtarget->isTargetCygMing())
+ O << "\t.local\t" << *GVarSym << '\n';
O << MAI->getCOMMDirective() << *GVarSym << ',' << Size;
if (MAI->getCOMMDirectiveTakesAlignment())
O << ',' << (MAI->getAlignmentIsInBytes() ? (1 << Align) : Align);