[PATCH] D75123: [obj2yaml, yaml2obj] - Read and dump the "Content" key of the RawContentSection section as array.
James Henderson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 2 01:55:06 PST 2020
jhenderson added a comment.
In D75123#1897851 <https://reviews.llvm.org/D75123#1897851>, @grimar wrote:
> 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 bytes well.
> It is currently impossible to split `Content` data to leave multi-line comments.
FWIW, I actually disagree with the statement that it is not always reasonable to teach yaml2obj about a new section type. I think if a binary blob is large enough that it needs commenting, it should be added to yaml2obj instead.
That being said, I could imagine a limited set of cases involving malformed inputs where even if the section is implemented in yaml2obj, you might need to use raw `Content`.
> 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.
This could possibly work, but I suspect people might be confused as to when to use one instead of the other. We probably need to update the `yaml2obj`/`obj2yaml` documentation. I might also suggest `ContentArray` as a name instead perhaps?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75123/new/
https://reviews.llvm.org/D75123
More information about the llvm-commits
mailing list