[llvm-branch-commits] [llvm] [llvm-objcopy] Stream ELF output to reduce peak memory usage (PR #217706)

James Henderson via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Oct 13 02:08:34 PDT 2026


================
@@ -976,30 +1046,34 @@ static void setAddend(Elf_Rel_Impl<ELFT, true> &Rela, uint64_t Addend) {
   Rela.r_addend = Addend;
 }
 
-template <class RelRange, class T>
-static void writeRel(const RelRange &Relocations, T *Buf, bool IsMips64EL) {
+template <class T, class RelRange>
+static void writeRel(raw_ostream &Out, const RelRange &Relocations,
+                     bool IsMips64EL) {
   for (const auto &Reloc : Relocations) {
-    Buf->r_offset = Reloc.Offset;
-    setAddend(*Buf, Reloc.Addend);
-    Buf->setSymbolAndType(Reloc.RelocSymbol ? Reloc.RelocSymbol->Index : 0,
-                          Reloc.Type, IsMips64EL);
-    ++Buf;
+    T Value = {};
----------------
jh7370 wrote:

Same comment.

https://github.com/llvm/llvm-project/pull/217706


More information about the llvm-branch-commits mailing list