[PATCH] D83672: [yaml2obj] - Refine handling of the NoHeaders key.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 13 05:52:40 PDT 2020


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

Imagine we have an YAML description for some object and we want to
produce 2 outputs: with and without the section header.
A natural way to do it would look like:

- !ELF

FileHeader:

  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_REL
  Machine: EM_X86_64

Sections:
...
SectionHeaderTable:

  NoHeaders: [[NOHEADERS]]

But currently, we do not distinguish between no `NoHeaders` key case
and `NoHeaders == false`. Because of this we can't simply specify
`NOHEADERS = false`, as tool starts to complain.

With this patch the behavior changed. When we have:

SectionHeaderTable:

  NoHeaders: false

it is the same as we have no `SectionHeaderTable` at all.
(`NoHeaders` key still can't be used with `Sections/Excluded` keys)


https://reviews.llvm.org/D83672

Files:
  llvm/include/llvm/ObjectYAML/ELFYAML.h
  llvm/lib/ObjectYAML/ELFEmitter.cpp
  llvm/lib/ObjectYAML/ELFYAML.cpp
  llvm/test/tools/yaml2obj/ELF/section-headers-exclude.yaml
  llvm/test/tools/yaml2obj/ELF/section-headers.yaml

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83672.277397.patch
Type: text/x-patch
Size: 6194 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200713/03200d8d/attachment.bin>


More information about the llvm-commits mailing list