[PATCH] D91693: [Support] Add reserve() method to the raw_ostream.

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 1 06:58:44 PST 2020


jhenderson added a comment.

In D91693#2425369 <https://reviews.llvm.org/D91693#2425369>, @avl wrote:

> @jhenderson James, what do you think of using streams as suggested by D91028 <https://reviews.llvm.org/D91028> and D91693 <https://reviews.llvm.org/D91693>? Would it be useful? It seems it would reduce amount of copied data.

Hi @avl,

Honestly, I don't have the time to look at this process in detail, and refactoring things to support an objcopy library is not high on my priority list. I'm not convinced that your suggestions are actually going to be workable/useful in practice, if I'm honest, and have tried to outline my concerns already. My biggest concern is how do you stream an ELF header without already knowing where your section header table will live. If you know where your section header table will live, you have all the information you need for presizing your output buffer, so being able to reserve post stream creation becomes pointless. There's no need to read the entire input object file into memory either - llvm-objcopy doesn't do this already (note that generic sections that require no manipulation just use an ArrayRef to refer to the section contents).

I will give it more thought, but I cannot guarantee when I'll be able to come back to this.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91693/new/

https://reviews.llvm.org/D91693



More information about the llvm-commits mailing list