X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FMC%2FMCSectionELF.cpp;h=3d8774ceeb27604b0d7ccc9e4f784c515544d71e;hb=e44313e0ca7ca3504dd9dc906e2eff8b36bc4ee4;hp=d172a9c923026313d7411f5eee4fe047333129ee;hpb=b808588a3a5febe931896b3779d159ba90d836f7;p=oota-llvm.git diff --git a/lib/MC/MCSectionELF.cpp b/lib/MC/MCSectionELF.cpp index d172a9c9230..3d8774ceeb2 100644 --- a/lib/MC/MCSectionELF.cpp +++ b/lib/MC/MCSectionELF.cpp @@ -16,20 +16,21 @@ using namespace llvm; MCSectionELF *MCSectionELF:: Create(const StringRef &Section, unsigned Type, unsigned Flags, - SectionKind K, bool hasCrazyBSS, bool isExplicit, MCContext &Ctx) { + SectionKind K, bool isExplicit, MCContext &Ctx) { return new - (Ctx) MCSectionELF(Section, Type, Flags, K, hasCrazyBSS, isExplicit); + (Ctx) MCSectionELF(Section, Type, Flags, K, isExplicit); } // ShouldOmitSectionDirective - Decides whether a '.section' directive // should be printed before the section name -bool MCSectionELF::ShouldOmitSectionDirective(const char *Name) const { +bool MCSectionELF::ShouldOmitSectionDirective(const char *Name, + const TargetAsmInfo &TAI) const { - // PPC/Linux doesn't support the .bss directive, it needs .section .bss. // FIXME: Does .section .bss/.data/.text work everywhere?? - if ((!HasCrazyBSS && strncmp(Name, ".bss", 4) == 0) || - strncmp(Name, ".text", 5) == 0 || - strncmp(Name, ".data", 5) == 0) + if (strcmp(Name, ".text") == 0 || + strcmp(Name, ".data") == 0 || + (strcmp(Name, ".bss") == 0 && + !TAI.usesELFSectionDirectiveForBSS())) return true; return false; @@ -46,8 +47,8 @@ bool MCSectionELF::ShouldPrintSectionType(unsigned Ty) const { void MCSectionELF::PrintSwitchToSection(const TargetAsmInfo &TAI, raw_ostream &OS) const { - - if (ShouldOmitSectionDirective(SectionName.c_str())) { + + if (ShouldOmitSectionDirective(SectionName.c_str(), TAI)) { OS << '\t' << getSectionName() << '\n'; return; } @@ -121,3 +122,15 @@ void MCSectionELF::PrintSwitchToSection(const TargetAsmInfo &TAI, OS << '\n'; } +// HasCommonSymbols - True if this section holds common symbols, this is +// indicated on the ELF object file by a symbol with SHN_COMMON section +// header index. +bool MCSectionELF::HasCommonSymbols() const { + + if (strncmp(SectionName.c_str(), ".gnu.linkonce.", 14) == 0) + return true; + + return false; +} + +