[all-commits] [llvm/llvm-project] 68195b: [yaml2obj] - Allow empty SectionHeaderTable defini...

Georgii Rymar via All-commits all-commits at lists.llvm.org
Wed Jan 27 23:52:38 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 68195b15a36c338751b7abe28819345617dd70fb
      https://github.com/llvm/llvm-project/commit/68195b15a36c338751b7abe28819345617dd70fb
  Author: Georgii Rymar <grimar at accesssoftek.com>
  Date:   2021-01-28 (Thu, 28 Jan 2021)

  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.yaml

  Log Message:
  -----------
  [yaml2obj] - Allow empty SectionHeaderTable definitions.

Currently we don't allow the following definition:

```
Sections:
  - Type: SectionHeaderTable
  - Name: .foo
    Type: SHT_PROGBITS
```

We report an error: "SectionHeaderTable can't be empty. Use 'NoHeaders' key to drop the section header table".

It was implemented in this way earlier, when `SectionHeaderTable`
was a dedicated key outside of the `Sections` list. And we did not
allow to select where the table is written.

Currently it makes sense to allow it, because a user might
want to place the default section header table at an arbitrary position,
e.g. before other sections. In this case it is not convenient and error prone
to require specifying all sections:

```
Sections:
  - Type: SectionHeaderTable
    Sections:
      - Name: .foo
      - Name: .strtab
      - Name: .shstrtab
  - Name: .foo
    Type: SHT_PROGBITS
```

This patch allows empty SectionHeaderTable definitions.

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




More information about the All-commits mailing list