[PATCH] D75123: [obj2yaml,yaml2obj] - Dump Content of the RawContentSection section as array.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 25 08:35:32 PST 2020


grimar created this revision.
grimar added reviewers: jhenderson, MaskRay.
Herald added subscribers: arphaman, hiraditya, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
grimar edited the summary of this revision.

For all of custom sections we have we use `Optional<yaml::BinaryRef>` for
describing `Content`. A `BinaryRef` is a specialized YAMLIO scalar type for
representing a binary blob. Because of this we dump a content as a single string.

This string is dumped in a one line and there is no way to split it and
add proper comments for each part.
I was asked today about possibility of writing a custom
number of bytes and commenting the each group of them. It is useful for
crafting new types of sections.

I was surprised that we unable to do something like:

  ## Comment 0.
  Content: [ 0xfe, 0xfe, 0xfe, 0xfe,
  ## Comment 1.
  0xfe, 0xfe,
  ## Comment 2.
  0xfe, 0xfe ]

In this patch I did a change for `RawContentSection` for start,
now it accepts and prints the vector of bytes for a `Content` which
is now `Optional<std::vector<uint8_t>>`.
How does the idea of such change sound?


https://reviews.llvm.org/D75123

Files:
  llvm/include/llvm/ObjectYAML/ELFYAML.h
  llvm/lib/ObjectYAML/ELFEmitter.cpp
  llvm/lib/ObjectYAML/ELFYAML.cpp
  llvm/test/tools/obj2yaml/elf-null-section.yaml
  llvm/test/tools/obj2yaml/invalid-section-name.yaml
  llvm/test/tools/yaml2obj/ELF/custom-fill.yaml
  llvm/test/tools/yaml2obj/ELF/dynsymtab-implicit-sections-size-content.yaml
  llvm/test/tools/yaml2obj/ELF/ent-size.yaml
  llvm/test/tools/yaml2obj/ELF/override-shoffset.yaml
  llvm/test/tools/yaml2obj/ELF/override-shsize.yaml
  llvm/test/tools/yaml2obj/ELF/program-header-nobits.yaml
  llvm/test/tools/yaml2obj/ELF/program-header.yaml
  llvm/test/tools/yaml2obj/ELF/relocation-implicit-symbol-index.yaml
  llvm/test/tools/yaml2obj/ELF/section-size-content.yaml
  llvm/test/tools/yaml2obj/ELF/strtab-implicit-sections-size-content.yaml
  llvm/test/tools/yaml2obj/ELF/symtab-implicit-sections-size-content.yaml
  llvm/tools/obj2yaml/elf2yaml.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75123.246478.patch
Type: text/x-patch
Size: 13697 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200225/65767e1a/attachment.bin>


More information about the llvm-commits mailing list