diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2010-11-09 22:54:38 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2010-11-09 22:54:38 +0000 |
commit | 037b5be15a421b99066bb284027750a16ddd0fae (patch) | |
tree | 17d836f2072d12cd9227ad4eeca4df26f1052b75 /lib/MC/MCSectionELF.cpp | |
parent | c3236753d6bb69d20003a7da441e9a42707ed714 (diff) |
Revert previous patch. Missed a case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118645 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCSectionELF.cpp')
-rw-r--r-- | lib/MC/MCSectionELF.cpp | 54 |
1 files changed, 32 insertions, 22 deletions
diff --git a/lib/MC/MCSectionELF.cpp b/lib/MC/MCSectionELF.cpp index 5bcf81021d..133cad1b32 100644 --- a/lib/MC/MCSectionELF.cpp +++ b/lib/MC/MCSectionELF.cpp @@ -29,6 +29,14 @@ bool MCSectionELF::ShouldOmitSectionDirective(StringRef Name, return false; } +// ShouldPrintSectionType - Only prints the section type if supported +bool MCSectionELF::ShouldPrintSectionType(unsigned Ty) const { + if (IsExplicit && !(Ty == SHT_NOBITS || Ty == SHT_PROGBITS)) + return false; + + return true; +} + void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI, raw_ostream &OS) const { @@ -76,29 +84,31 @@ void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI, OS << '"'; - OS << ','; - - // If comment string is '@', e.g. as on ARM - use '%' instead - if (MAI.getCommentString()[0] == '@') - OS << '%'; - else - OS << '@'; - - if (Type == MCSectionELF::SHT_INIT_ARRAY) - OS << "init_array"; - else if (Type == MCSectionELF::SHT_FINI_ARRAY) - OS << "fini_array"; - else if (Type == MCSectionELF::SHT_PREINIT_ARRAY) - OS << "preinit_array"; - else if (Type == MCSectionELF::SHT_NOBITS) - OS << "nobits"; - else if (Type == MCSectionELF::SHT_PROGBITS) - OS << "progbits"; - - if (EntrySize) { - OS << "," << EntrySize; + if (ShouldPrintSectionType(Type)) { + OS << ','; + + // If comment string is '@', e.g. as on ARM - use '%' instead + if (MAI.getCommentString()[0] == '@') + OS << '%'; + else + OS << '@'; + + if (Type == MCSectionELF::SHT_INIT_ARRAY) + OS << "init_array"; + else if (Type == MCSectionELF::SHT_FINI_ARRAY) + OS << "fini_array"; + else if (Type == MCSectionELF::SHT_PREINIT_ARRAY) + OS << "preinit_array"; + else if (Type == MCSectionELF::SHT_NOBITS) + OS << "nobits"; + else if (Type == MCSectionELF::SHT_PROGBITS) + OS << "progbits"; + + if (EntrySize) { + OS << "," << EntrySize; + } } - + OS << '\n'; } |