diff options
Diffstat (limited to 'llvm/lib/MC/MCELFStreamer.cpp')
-rw-r--r-- | llvm/lib/MC/MCELFStreamer.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/llvm/lib/MC/MCELFStreamer.cpp b/llvm/lib/MC/MCELFStreamer.cpp index b88a572..6d30f2e 100644 --- a/llvm/lib/MC/MCELFStreamer.cpp +++ b/llvm/lib/MC/MCELFStreamer.cpp @@ -107,13 +107,14 @@ static void setSectionAlignmentForBundling(const MCAssembler &Assembler, } void MCELFStreamer::changeSection(MCSection *Section, uint32_t Subsection) { - MCSection *CurSection = getCurrentSectionOnly(); - if (CurSection && isBundleLocked()) - report_fatal_error("Unterminated .bundle_lock when changing a section"); - MCAssembler &Asm = getAssembler(); - // Ensure the previous section gets aligned if necessary. - setSectionAlignmentForBundling(Asm, CurSection); + if (auto *F = getCurrentFragment()) { + if (isBundleLocked()) + report_fatal_error("Unterminated .bundle_lock when changing a section"); + + // Ensure the previous section gets aligned if necessary. + setSectionAlignmentForBundling(Asm, F->getParent()); + } auto *SectionELF = static_cast<const MCSectionELF *>(Section); const MCSymbol *Grp = SectionELF->getGroup(); if (Grp) |