[PATCH] D52917: Avoid unnecessary buffer allocation and memcpy for compressed sections.

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 4 17:28:23 PDT 2018


dblaikie added a comment.

In https://reviews.llvm.org/D52917#1256109, @ruiu wrote:

> In lld, we do apply relocations after we copy input section contents to the output buffer, so this patch doesn't affect how we apply relocations. If a compressed section contains relocations, they are processed fine like before.


Ah, awesome - should've guessed that might be the case. This sounds like it could be really helpful for all debug sections, then!

I see this uncompresses directly into the output, which is also great - no need to have the whole uncompressed contents in memory at any one time, then.

Out of curiosity - does LLD support compressed output? How/where does it do that? It'd be super nifty if it'd stream in the compressed data and stream it out through compression without having to have it all decompressed in memory. But that might hit problems with relocations that use the bytes in the section as part of the relocation computation :/



================
Comment at: lld/ELF/InputSection.cpp:144
+  size_t Size = UncompressedSize;
+  UncompressedBuf.reset(new char[Size]());
+
----------------
Did you intend to zero out this allocation? (the '()' after the [] will cause the array to be zero initialized, I think - which might be unnecessary if you're about to write to all the bytes anyway?)


https://reviews.llvm.org/D52917





More information about the llvm-commits mailing list