aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCMachOStreamer.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2025-07-28 20:35:35 -0700
committerFangrui Song <i@maskray.me>2025-07-28 20:35:35 -0700
commit2bebbe166b1d5c6803b5d0f8794df3a18eff8e03 (patch)
treeb68dbae65a15b6decd252ae2ef7d7698c04b49fb /llvm/lib/MC/MCMachOStreamer.cpp
parent217f9e57d1cc46de51d3b36177c4ba4049aaa805 (diff)
downloadllvm-2bebbe166b1d5c6803b5d0f8794df3a18eff8e03.zip
llvm-2bebbe166b1d5c6803b5d0f8794df3a18eff8e03.tar.gz
llvm-2bebbe166b1d5c6803b5d0f8794df3a18eff8e03.tar.bz2
MCFragment: Migrate away from appendContents
The fixed-size content of the MCFragment object will be stored as trailing data (#150846). Any post-assembler-layout adjustments must target the variable-size tail.
Diffstat (limited to 'llvm/lib/MC/MCMachOStreamer.cpp')
-rw-r--r--llvm/lib/MC/MCMachOStreamer.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/MC/MCMachOStreamer.cpp b/llvm/lib/MC/MCMachOStreamer.cpp
index 1074669..a214513 100644
--- a/llvm/lib/MC/MCMachOStreamer.cpp
+++ b/llvm/lib/MC/MCMachOStreamer.cpp
@@ -484,7 +484,8 @@ void MCMachOStreamer::finalizeCGProfile() {
// 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));
- (*CGProfileSection->begin()).appendContents(SectionBytes, 0);
+ (*CGProfileSection->begin())
+ .setVarContents(std::vector<char>(SectionBytes, 0));
}
MCStreamer *llvm::createMachOStreamer(MCContext &Context,
@@ -520,5 +521,6 @@ void MCMachOStreamer::createAddrSigSection() {
// (instead of emitting a zero-sized section) so these relocations are
// technically valid, even though we don't expect these relocations to
// actually be applied by the linker.
- Frag->appendContents(8, 0);
+ constexpr char zero[8] = {};
+ Frag->setVarContents(zero);
}