[all-commits] [llvm/llvm-project] 338665: [llvm-objcopy] Stream ELF output to regular files

Farid Zakaria via All-commits all-commits at lists.llvm.org
Tue Sep 8 10:16:26 PDT 2026


  Branch: refs/heads/users/fmzakari/llvm-objcopy-stream
  Home:   https://github.com/llvm/llvm-project
  Commit: 338665699336883954db21315a6c68db04ed0e10
      https://github.com/llvm/llvm-project/commit/338665699336883954db21315a6c68db04ed0e10
  Author: Farid Zakaria <fmzakari at fb.com>
  Date:   2026-09-08 (Tue, 08 Sep 2026)

  Changed paths:
    M llvm/lib/ObjCopy/ELF/ELFObject.cpp
    M llvm/lib/ObjCopy/ELF/ELFObject.h
    M llvm/unittests/ObjCopy/ObjCopyTest.cpp

  Log Message:
  -----------
  [llvm-objcopy] Stream ELF output to regular files

Write ELF output directly to seekable regular files instead of first allocating a buffer for the entire output. Keep buffered output for stdout and other non-seekable streams.

Use separate buffered and file-backed output implementations. Serialize regenerated metadata sequentially, seeking once per output range, and report sticky file errors after writing finishes. Truncate and extend seekable output up front so unwritten layout gaps read as zero without being materialized; explicitly overwrite only removed section contents within copied segments.

On a synthetic stamping-style ELF containing a 1 GiB payload, three warm-cache no-op copies had median peak RSS of 2,102,916 KiB before and 1,053,844 KiB after (49.9% lower). Median wall time improved from 1.06 s to 0.77 s, and the outputs were byte-identical.

Co-authored-by: Jeremy Braun <jtbraun at meta.com>
Co-authored-by: Fangrui Song <i at maskray.me>
Assisted-by: OpenAI Codex



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list