[llvm] 0b3579b - MCMachOStreamer: Call MCObjectStreamer::changeSection

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 22 23:48:11 PDT 2025


Author: Fangrui Song
Date: 2025-07-22T23:48:06-07:00
New Revision: 0b3579bedcb2ac608b1a68bf967386c4600554ea

URL: https://github.com/llvm/llvm-project/commit/0b3579bedcb2ac608b1a68bf967386c4600554ea
DIFF: https://github.com/llvm/llvm-project/commit/0b3579bedcb2ac608b1a68bf967386c4600554ea.diff

LOG: MCMachOStreamer: Call MCObjectStreamer::changeSection

We don't want to emit linker-local label `ltmpN` for addrsig and
cg_profile sections. Make the intention clear to prepare for the pending
refactoring that moves emitLabel from switchSection to changeSection.

Added: 
    

Modified: 
    llvm/lib/MC/MCMachOStreamer.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/MC/MCMachOStreamer.cpp b/llvm/lib/MC/MCMachOStreamer.cpp
index 756039944fc25..8f023bd109d31 100644
--- a/llvm/lib/MC/MCMachOStreamer.cpp
+++ b/llvm/lib/MC/MCMachOStreamer.cpp
@@ -478,7 +478,8 @@ void MCMachOStreamer::finalizeCGProfile() {
   // and set its size now so that it's accounted for in layout.
   MCSection *CGProfileSection = Asm.getContext().getMachOSection(
       "__LLVM", "__cg_profile", 0, SectionKind::getMetadata());
-  changeSection(CGProfileSection);
+  // Call the base class changeSection to omit the linker-local label.
+  MCObjectStreamer::changeSection(CGProfileSection);
   // For each entry, reserve space for 2 32-bit indices and a 64-bit count.
   size_t SectionBytes =
       W.getCGProfile().size() * (2 * sizeof(uint32_t) + sizeof(uint64_t));
@@ -510,7 +511,8 @@ void MCMachOStreamer::createAddrSigSection() {
   // to be computed immediately after in order for it to be exported correctly.
   MCSection *AddrSigSection =
       Asm.getContext().getObjectFileInfo()->getAddrSigSection();
-  changeSection(AddrSigSection);
+  // Call the base class changeSection to omit the linker-local label.
+  MCObjectStreamer::changeSection(AddrSigSection);
   auto *Frag = cast<MCFragment>(AddrSigSection->curFragList()->Head);
   // We will generate a series of pointer-sized symbol relocations at offset
   // 0x0. Set the section size to be large enough to contain a single pointer


        


More information about the llvm-commits mailing list