[PATCH] D75123: [obj2yaml, yaml2obj] - Read and dump the "Content" key of the RawContentSection section as array.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 28 05:00:40 PST 2020


grimar added a comment.

In D75123#1895005 <https://reviews.llvm.org/D75123#1895005>, @jhenderson wrote:

> In D75123#1892941 <https://reviews.llvm.org/D75123#1892941>, @grimar wrote:
>
> > 3. Using large chunk of raw bytes is a bad practice. Should we care much about keeping a shorter way to describe it?
>
>
> I think this is the key question to me. We shouldn't be encouraging large binary blobs, and if we get a situation where one is needed, perhaps the test needs simplifying/converting to assembly, or obj2yaml/yaml2obj needs extending. In other words, I don't think this change is particularly useful, as blobs should be kept to very short amounts (circa 32 bytes I reckon at most).


There are cases where using yaml2obj is preferable over llvm-mc, but you may have blobs that are not little. Imagine you prototype a new section and want to write a test
for a dumper tool for example. It is not always reasonable to teach yaml2obj about a new section type. So you still might want to use `Content`, but want to comment them it well.
It is currently impossible to split `Content` data to leave multi-line comments.

An idea:
What if we introduce a one more YAML key: "ContentBytes"? I.e. we keep `Optional<yaml::BinaryRef> Content` as is,
but also add `Optional<std::vector<uint8_t>> ContentBytes` for those who would like to comment group of bytes
and use `[ 0x1, 0x2 ]` style for whatever reason is.


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

https://reviews.llvm.org/D75123





More information about the llvm-commits mailing list