aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCStreamer.cpp
diff options
context:
space:
mode:
authordyung <douglas.yung@sony.com>2025-07-25 23:21:59 -0400
committerGitHub <noreply@github.com>2025-07-25 20:21:59 -0700
commitcb37916a2596e0936c76bbd9927f8353faac9fa8 (patch)
tree8b4dce8ecf8199bfe52f9625b6062d10e1a7d38c /llvm/lib/MC/MCStreamer.cpp
parent3f8a05893f98989630b6f498c6c5f382afe24561 (diff)
downloadllvm-cb37916a2596e0936c76bbd9927f8353faac9fa8.zip
llvm-cb37916a2596e0936c76bbd9927f8353faac9fa8.tar.gz
llvm-cb37916a2596e0936c76bbd9927f8353faac9fa8.tar.bz2
Revert "MC: Allocate initial fragment and define section symbol in changeSection" (#150736)
Reverts llvm/llvm-project#150574 This is causing a test failure on AArch64 MacOS bots: https://lab.llvm.org/buildbot/#/builders/190/builds/24187
Diffstat (limited to 'llvm/lib/MC/MCStreamer.cpp')
-rw-r--r--llvm/lib/MC/MCStreamer.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp
index 899a7df..e14a32f5 100644
--- a/llvm/lib/MC/MCStreamer.cpp
+++ b/llvm/lib/MC/MCStreamer.cpp
@@ -1314,10 +1314,8 @@ void MCStreamer::emitZerofill(MCSection *, MCSymbol *, uint64_t, Align, SMLoc) {
}
void MCStreamer::emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
uint64_t Size, Align ByteAlignment) {}
-void MCStreamer::changeSection(MCSection *Sec, uint32_t) {
- CurFrag = &Sec->getDummyFragment();
- if (auto *Sym = Sec->getBeginSymbol())
- Sym->setFragment(&Sec->getDummyFragment());
+void MCStreamer::changeSection(MCSection *Section, uint32_t) {
+ CurFrag = &Section->getDummyFragment();
}
void MCStreamer::emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) {}
void MCStreamer::emitBytes(StringRef Data) {}
@@ -1360,6 +1358,9 @@ void MCStreamer::switchSection(MCSection *Section, uint32_t Subsection) {
changeSection(Section, Subsection);
SectionStack.back().first = MCSectionSubPair(Section, Subsection);
assert(!Section->hasEnded() && "Section already ended");
+ MCSymbol *Sym = Section->getBeginSymbol();
+ if (Sym && !Sym->isInSection())
+ emitLabel(Sym);
}
}
@@ -1386,6 +1387,9 @@ void MCStreamer::switchSectionNoPrint(MCSection *Section) {
SectionStack.back().second = SectionStack.back().first;
SectionStack.back().first = MCSectionSubPair(Section, 0);
changeSection(Section, 0);
+ MCSymbol *Sym = Section->getBeginSymbol();
+ if (Sym && !Sym->isInSection())
+ emitLabel(Sym);
}
MCSymbol *MCStreamer::endSection(MCSection *Section) {