Close unique sections when switching away from them.

It is not possible to switch back to unique secitons, so close them
automatically when switching away.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233380 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2015-03-27 15:01:40 +00:00
parent 407da8c267
commit 121eb4257d
7 changed files with 17 additions and 9 deletions

View File

@@ -669,6 +669,12 @@ void MCStreamer::SwitchSection(const MCSection *Section,
MCSectionSubPair curSection = SectionStack.back().first;
SectionStack.back().second = curSection;
if (MCSectionSubPair(Section, Subsection) != curSection) {
const MCSection *CurSec = curSection.first;
if (CurSec && CurSec->isUnique()) {
MCSymbol *Sym = curSection.first->getEndSymbol(Context);
if (!Sym->isInSection())
EmitLabel(Sym);
}
SectionStack.back().first = MCSectionSubPair(Section, Subsection);
assert(!Section->hasEnded() && "Section already ended");
ChangeSection(Section, Subsection);