[PATCH] D69709: [yaml2obj][WIP] - Add a way to describe the custom data that is not part of an output section.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 1 05:52:00 PDT 2019


grimar created this revision.
grimar added reviewers: jhenderson, MaskRay, rupprecht, labath.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

This is a WIP patch, though its functionality is almost ready. It still lacks many tests I'd
like to add and a few sanity checks. But it has test cases showing how the current functionality
works and how it is usefull. I am posting it to hear opinions/feedback about the whole
approach before I move forward.

Currently there is no way to describe the data that is not a part of an output section.
It can be a data used to align sections or to fill the gaps with something,
or another kind of custom data. In this patch I suggest a way to describe it. It looks like that:

  Sections:
    - Type:    CustomFiller
      Pattern: "CCDD"
      Size:    4
    - Name:    .bar
      Type:    SHT_PROGBITS
      Content: "FF"

I.e. I've added a kind of synthetic section with a synthetic type "CustomFiller".
In the code it is called a "SyntheticFiller", which is "a synthetic section which
might be used to write the custom data around regular output sections. It does
not present in the sections header table, but it might affect the output file size and
program headers produced. Think about it as about piece of data."

`SyntheticFiller` currently has a `Pattern` field and a `Size` field + an optional `Name`.
When written, `Size` of bytes in the output will be filled with a `Pattern`.
When filles has a name it is possible to reference it by name from the program headers description,
just like the normal section.


https://reviews.llvm.org/D69709

Files:
  llvm/include/llvm/ObjectYAML/ELFYAML.h
  llvm/include/llvm/ObjectYAML/YAML.h
  llvm/lib/ObjectYAML/ELFEmitter.cpp
  llvm/lib/ObjectYAML/ELFYAML.cpp
  llvm/lib/ObjectYAML/YAML.cpp
  llvm/test/tools/yaml2obj/custom-filler.yaml

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69709.227428.patch
Type: text/x-patch
Size: 29947 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191101/a93fed8b/attachment.bin>


More information about the llvm-commits mailing list