summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCSectionELF.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2010-11-09 23:42:07 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2010-11-09 23:42:07 +0000
commit9bb44a5ce816092153b740be7938ccf0b96a11fd (patch)
tree00956d72bf432a48a8297dfd7631148e239dfe7d /llvm/lib/MC/MCSectionELF.cpp
parentbb4f8e6f7b9eea983f91d3c918301d02680d1ab2 (diff)
downloadbcm5719-llvm-9bb44a5ce816092153b740be7938ccf0b96a11fd.tar.gz
bcm5719-llvm-9bb44a5ce816092153b740be7938ccf0b96a11fd.zip
Fixed version of 118639 with an extra assert to catch similar problems
earlier. Implicit bool -> int conversions are evil! llvm-svn: 118651
Diffstat (limited to 'llvm/lib/MC/MCSectionELF.cpp')
-rw-r--r--llvm/lib/MC/MCSectionELF.cpp55
1 files changed, 23 insertions, 32 deletions
diff --git a/llvm/lib/MC/MCSectionELF.cpp b/llvm/lib/MC/MCSectionELF.cpp
index 133cad1b32c..ab72a0ebf96 100644
--- a/llvm/lib/MC/MCSectionELF.cpp
+++ b/llvm/lib/MC/MCSectionELF.cpp
@@ -29,14 +29,6 @@ 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 {
@@ -84,31 +76,30 @@ void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI,
OS << '"';
- 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 << ',';
+
+ // 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) {
+ assert(Flags & MCSectionELF::SHF_MERGE);
+ OS << "," << EntrySize;
}
-
+
OS << '\n';
}
OpenPOWER on IntegriCloud