summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCSectionELF.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2013-04-17 21:18:16 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2013-04-17 21:18:16 +0000
commit2f495b93eeab096e9d4f7df05ccde4c7538f53cb (patch)
tree525e7451f9c68ecf1a01d3df94e9e5cde4c23b39 /llvm/lib/MC/MCSectionELF.cpp
parent6241c1a63ddc23c670e978e0dcb40bc3af9ec209 (diff)
downloadbcm5719-llvm-2f495b93eeab096e9d4f7df05ccde4c7538f53cb.tar.gz
bcm5719-llvm-2f495b93eeab096e9d4f7df05ccde4c7538f53cb.zip
Add support for subsections to the ELF assembler. Fixes PR8717.
Differential Revision: http://llvm-reviews.chandlerc.com/D598 llvm-svn: 179725
Diffstat (limited to 'llvm/lib/MC/MCSectionELF.cpp')
-rw-r--r--llvm/lib/MC/MCSectionELF.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/llvm/lib/MC/MCSectionELF.cpp b/llvm/lib/MC/MCSectionELF.cpp
index 0775cfa776d..bf1a984a9bf 100644
--- a/llvm/lib/MC/MCSectionELF.cpp
+++ b/llvm/lib/MC/MCSectionELF.cpp
@@ -10,6 +10,7 @@
#include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
+#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Support/ELF.h"
#include "llvm/Support/raw_ostream.h"
@@ -32,10 +33,14 @@ bool MCSectionELF::ShouldOmitSectionDirective(StringRef Name,
}
void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI,
- raw_ostream &OS) const {
+ raw_ostream &OS,
+ const MCExpr *Subsection) const {
if (ShouldOmitSectionDirective(SectionName, MAI)) {
- OS << '\t' << getSectionName() << '\n';
+ OS << '\t' << getSectionName();
+ if (Subsection)
+ OS << '\t' << *Subsection;
+ OS << '\n';
return;
}
@@ -129,6 +134,9 @@ void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI,
if (Flags & ELF::SHF_GROUP)
OS << "," << Group->getName() << ",comdat";
OS << '\n';
+
+ if (Subsection)
+ OS << "\t.subsection\t" << *Subsection << '\n';
}
bool MCSectionELF::UseCodeAlign() const {
OpenPOWER on IntegriCloud