use section flags more correctly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76944 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2009-07-24 04:08:17 +00:00
parent 7da9559c52
commit c440cc7f2c
4 changed files with 8 additions and 7 deletions

View File

@ -123,6 +123,8 @@ namespace llvm {
const std::string& getName() const { return Name; }
unsigned getFlags() const { return Flags; }
bool hasFlag(unsigned F) const { return (Flags & F) != 0; }
};
/// TargetAsmInfo - This class is intended to be used as a base class for asm

View File

@ -1103,9 +1103,8 @@ void ARMAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
SwitchToSection(TheSection);
if (C->isNullValue() && !GVar->hasSection() && !GVar->isThreadLocal() &&
!(isDarwin && TheSection->getFlags() == SectionKind::RODataMergeStr)) {
// FIXME: This seems to be pretty darwin-specific
// Don't put things that should go in the cstring section into "comm".
!TheSection->hasFlag(SectionFlags::Strings)) {
if (GVar->hasExternalLinkage()) {
if (const char *Directive = TAI->getZeroFillDirective()) {
O << "\t.globl\t" << name << "\n";

View File

@ -897,7 +897,8 @@ void PPCDarwinAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) {
!GVar->hasSection() &&
(GVar->hasLocalLinkage() || GVar->hasExternalLinkage() ||
GVar->isWeakForLinker()) &&
TheSection->getFlags() != SectionKind::RODataMergeStr) {
// Don't put things that should go in the cstring section into "comm".
!TheSection->hasFlag(SectionFlags::Strings)) {
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
if (GVar->hasExternalLinkage()) {

View File

@ -798,9 +798,8 @@ void X86ATTAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
SwitchToSection(TheSection);
if (C->isNullValue() && !GVar->hasSection() &&
!(Subtarget->isTargetDarwin() &&
TAI->SectionKindForGlobal(GVar) == SectionKind::RODataMergeStr)) {
// FIXME: This seems to be pretty darwin-specific
// Don't put things that should go in the cstring section into "comm".
!TheSection->hasFlag(SectionFlags::Strings)) {
if (GVar->hasExternalLinkage()) {
if (const char *Directive = TAI->getZeroFillDirective()) {
O << "\t.globl " << name << '\n';