[all-commits] [llvm/llvm-project] 90e34b: [yaml2obj] - Refine handling of the NoHeaders key.

Georgii Rymar via All-commits all-commits at lists.llvm.org
Tue Jul 14 05:21:02 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 90e34b563affb145c43ec73f66410a9d1c4dc57a
      https://github.com/llvm/llvm-project/commit/90e34b563affb145c43ec73f66410a9d1c4dc57a
  Author: Georgii Rymar <grimar at accesssoftek.com>
  Date:   2020-07-14 (Tue, 14 Jul 2020)

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

  Log Message:
  -----------
  [yaml2obj] - Refine handling of the NoHeaders key.

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)

Differential revision: https://reviews.llvm.org/D83672




More information about the All-commits mailing list