diff options
author | Fangrui Song <i@maskray.me> | 2024-06-27 22:00:40 -0700 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2024-06-27 22:00:40 -0700 |
commit | fadc72235ed59eba8538d803fba5c79cd9cda5e9 (patch) | |
tree | e39469acacc6d5500babcc4e92247d21d83045d1 /llvm/lib | |
parent | 567b2c608c307c097315dd5ec4d6a5bbcddf898d (diff) | |
download | llvm-fadc72235ed59eba8538d803fba5c79cd9cda5e9.zip llvm-fadc72235ed59eba8538d803fba5c79cd9cda5e9.tar.gz llvm-fadc72235ed59eba8538d803fba5c79cd9cda5e9.tar.bz2 |
[MC] switchSectionNoPrint: update CurFrag
To ensure that CurFrag->Parent and SectionStack.back() are in sync.
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/MC/MCAsmStreamer.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/MC/MCObjectStreamer.cpp | 5 | ||||
-rw-r--r-- | llvm/lib/MC/MCStreamer.cpp | 6 |
3 files changed, 13 insertions, 2 deletions
diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp index ff240d1..31994e5 100644 --- a/llvm/lib/MC/MCAsmStreamer.cpp +++ b/llvm/lib/MC/MCAsmStreamer.cpp @@ -2209,7 +2209,7 @@ void MCAsmStreamer::emitWinEHHandlerData(SMLoc Loc) { MCSection *TextSec = &CurFrame->Function->getSection(); MCSection *XData = getAssociatedXDataSection(TextSec); - switchSectionNoChange(XData); + switchSectionNoPrint(XData); OS << "\t.seh_handlerdata"; EmitEOL(); @@ -2626,7 +2626,7 @@ void MCAsmStreamer::doFinalizationAtSectionEnd(MCSection *Section) { if (MAI->usesDwarfFileAndLocDirectives()) return; - switchSectionNoChange(Section); + switchSectionNoPrint(Section); MCSymbol *Sym = getCurrentSectionOnly()->getEndSymbol(getContext()); diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp index b8ed1d6..6dddaa4 100644 --- a/llvm/lib/MC/MCObjectStreamer.cpp +++ b/llvm/lib/MC/MCObjectStreamer.cpp @@ -313,6 +313,11 @@ bool MCObjectStreamer::changeSectionImpl(MCSection *Section, return getAssembler().registerSection(*Section); } +void MCObjectStreamer::switchSectionNoPrint(MCSection *Section) { + MCStreamer::switchSectionNoPrint(Section); + changeSection(Section, 0); +} + void MCObjectStreamer::emitAssignment(MCSymbol *Symbol, const MCExpr *Value) { getAssembler().registerSymbol(*Symbol); MCStreamer::emitAssignment(Symbol, Value); diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp index cfc27be..c0879fd 100644 --- a/llvm/lib/MC/MCStreamer.cpp +++ b/llvm/lib/MC/MCStreamer.cpp @@ -1290,6 +1290,12 @@ bool MCStreamer::switchSection(MCSection *Section, const MCExpr *SubsecExpr) { return false; } +void MCStreamer::switchSectionNoPrint(MCSection *Section) { + SectionStack.back().second = SectionStack.back().first; + SectionStack.back().first = MCSectionSubPair(Section, 0); + CurFrag = &Section->getDummyFragment(); +} + MCSymbol *MCStreamer::endSection(MCSection *Section) { // TODO: keep track of the last subsection so that this symbol appears in the // correct place. |