[PATCH] D86847: [Bitcode] Add BITCODE_SIZE_BLOCK_ID to encode the size of the bitcode

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 16 19:13:32 PDT 2020


dblaikie added a comment.

In D86847#2278056 <https://reviews.llvm.org/D86847#2278056>, @MaskRay wrote:

> The idea is to add a terminator block, but a terminator carries less information so this patch intends to add a size block instead. With a terminator, the following problem can be better addressed
>
>   // We may be consuming bitcode from a client that leaves garbage at the end
>   // of the bitcode stream (e.g. Apple's ar tool). If we are close enough to
>   // the end that there cannot possibly be another module, stop looking.
>
> If the container does not expect more than one bitcode stream. Then after passing one stream, it can bail out.
> For users who want to have multiple streams, they can strip any padding. The scheme will automatically work with most binary formats (alignment=1).

It'd be nice to not have two different tools to solve what seem to be fairly similar problems. Perhaps the MachO/bitcode wrapper could be simplified if the alignment issue was fixed there? (not sure if it needs the full header, etc) & be a simple prefix length, perhaps. I'm probably a bit biased by DWARF, but it seems nice to be able to read a length fairly quickly/easily and skip the rest, rather than having to parse the contents to find out where it ends.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86847



More information about the llvm-commits mailing list