mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-09 16:45:03 +00:00
now that elf weak bss symbols are handled correctly, simplify a bunch of code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93845 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c7fbe90389
commit
56b1319fbe
@ -1238,39 +1238,14 @@ void ARMAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
|
||||
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';
|
||||
|
@ -736,22 +736,11 @@ void PPCLinuxAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) {
|
||||
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());
|
||||
@ -1003,34 +992,19 @@ void PPCDarwinAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) {
|
||||
|
||||
/// 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;
|
||||
}
|
||||
|
||||
|
@ -717,8 +717,7 @@ void X86AsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
|
||||
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()) {
|
||||
@ -726,29 +725,10 @@ void X86AsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
|
||||
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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user