Honor user-defined section specification of a global, ignores whether its initializer is null.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42182 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng 2007-09-21 00:41:19 +00:00
parent a72a5a095d
commit 76a4023096
3 changed files with 7 additions and 8 deletions

View File

@ -835,7 +835,7 @@ bool ARMAsmPrinter::doFinalization(Module &M) {
if (Subtarget->isTargetELF())
O << "\t.type " << name << ",%object\n";
if (C->isNullValue()) {
if (C->isNullValue() && !I->hasSection()) {
if (I->hasExternalLinkage()) {
if (const char *Directive = TAI->getZeroFillDirective()) {
O << "\t.globl\t" << name << "\n";
@ -845,9 +845,8 @@ bool ARMAsmPrinter::doFinalization(Module &M) {
}
}
if (!I->hasSection() &&
(I->hasInternalLinkage() || I->hasWeakLinkage() ||
I->hasLinkOnceLinkage())) {
if (I->hasInternalLinkage() || I->hasWeakLinkage() ||
I->hasLinkOnceLinkage()) {
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
if (!NoZerosInBSS && TAI->getBSSSection())
SwitchToDataSection(TAI->getBSSSection(), I);

View File

@ -661,9 +661,9 @@ bool LinuxAsmPrinter::doFinalization(Module &M) {
unsigned Align = TD->getPreferredAlignmentLog(I);
if (C->isNullValue() && /* FIXME: Verify correct */
!I->hasSection() &&
(I->hasInternalLinkage() || I->hasWeakLinkage() ||
I->hasLinkOnceLinkage() ||
(I->hasExternalLinkage() && !I->hasSection()))) {
I->hasLinkOnceLinkage() || I->hasExternalLinkage())) {
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
if (I->hasExternalLinkage()) {
O << "\t.global " << name << '\n';

View File

@ -170,7 +170,7 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
if (Subtarget->isTargetELF())
O << "\t.type\t" << name << ",@object\n";
if (C->isNullValue()) {
if (C->isNullValue() && !I->hasSection()) {
if (I->hasExternalLinkage()) {
if (const char *Directive = TAI->getZeroFillDirective()) {
O << "\t.globl\t" << name << "\n";
@ -180,7 +180,7 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
}
}
if (!I->hasSection() && !I->isThreadLocal() &&
if (!I->isThreadLocal() &&
(I->hasInternalLinkage() || I->hasWeakLinkage() ||
I->hasLinkOnceLinkage())) {
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.