summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCStreamer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/MC/MCStreamer.cpp')
-rw-r--r--llvm/lib/MC/MCStreamer.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp
index 63b0bf2c80f..27d0355bb11 100644
--- a/llvm/lib/MC/MCStreamer.cpp
+++ b/llvm/lib/MC/MCStreamer.cpp
@@ -670,9 +670,22 @@ void MCStreamer::SwitchSection(const MCSection *Section,
SectionStack.back().second = curSection;
if (MCSectionSubPair(Section, Subsection) != curSection) {
SectionStack.back().first = MCSectionSubPair(Section, Subsection);
+ assert(!Section->hasEnded() && "Section already ended");
ChangeSection(Section, Subsection);
MCSymbol *Sym = Section->getBeginSymbol();
if (Sym && !Sym->isInSection())
EmitLabel(Sym);
}
}
+
+MCSymbol *MCStreamer::endSection(const MCSection *Section) {
+ // TODO: keep track of the last subsection so that this symbol appears in the
+ // correct place.
+ MCSymbol *Sym = Section->getEndSymbol(Context);
+ if (Sym->isInSection())
+ return Sym;
+
+ SwitchSection(Section);
+ EmitLabel(Sym);
+ return Sym;
+}
OpenPOWER on IntegriCloud