summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCSectionELF.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2010-11-09 22:54:38 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2010-11-09 22:54:38 +0000
commit33048f069fe70f0b7ae4ddc74ce39304f5a8a7f7 (patch)
treeb722ac3da285a0e189c3ca704d00cc296a16dc55 /llvm/lib/MC/MCSectionELF.cpp
parentda3c0fbc64ee954daad992b7b200350881240811 (diff)
downloadbcm5719-llvm-33048f069fe70f0b7ae4ddc74ce39304f5a8a7f7.tar.gz
bcm5719-llvm-33048f069fe70f0b7ae4ddc74ce39304f5a8a7f7.zip
Revert previous patch. Missed a case.
llvm-svn: 118645
Diffstat (limited to 'llvm/lib/MC/MCSectionELF.cpp')
-rw-r--r--llvm/lib/MC/MCSectionELF.cpp54
1 files changed, 32 insertions, 22 deletions
diff --git a/llvm/lib/MC/MCSectionELF.cpp b/llvm/lib/MC/MCSectionELF.cpp
index 5bcf81021d7..133cad1b32c 100644
--- a/llvm/lib/MC/MCSectionELF.cpp
+++ b/llvm/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';
}
OpenPOWER on IntegriCloud