[llvm] Implement streaming compression for compressed ELF sections. (PR #87211)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 25 23:14:25 PDT 2024


================
@@ -201,6 +261,51 @@ void zstd::compress(ArrayRef<uint8_t> Input,
     CompressedBuffer.truncate(CompressedSize);
 }
 
+void zstd::compressToStream(ArrayRef<uint8_t> Input, raw_ostream &OS, int Level,
+                            bool EnableLdm) {
+  // Allocate a buffer to hold the output.
+  size_t OutBufferSize = ZSTD_CStreamOutSize();
----------------
MaskRay wrote:

lld/ELF/OutputSections.cpp:395 has a good example to simplify the zstd api usage.

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


More information about the llvm-commits mailing list