llvm-project/llvm
Georgii Rymar ec4e68e667 [yaml2obj] - Introduce the "NoHeaders" key for "SectionHeaderTable"
We have an issue currently. The following YAML piece just ignores the `Excluded` key.

```
SectionHeaderTable:
  Sections: []
  Excluded:
    - Name: .foo
```

Currently the meaning is: exclude the whole table.

The code checks that the `Sections` key is empty and doesn't catch/check
invalid/duplicated/missed `Excluded` entries.

Also there is no way to exclude all sections except the first null section,
because `Sections: []` currently just excludes the whole the sections header table.

To fix it, I suggest a change of the behavior.

1) A new `NoHeaders` key is added. It provides an explicit syntax to drop the whole table.
2) The meaning of the following is changed:

```
SectionHeaderTable:
  Sections: []
  Excluded:
    - Name: .foo

```
Assuming there are 2 sections in the object (a null section and `.foo`), with this patch it
means: exclude the `.foo` section, keep the null section. The null section is an implicit
section and I think it is reasonable to make "Sections: []" to mean it is implicitly added.
It will be consistent with the global "Sections" tag that is used to describe sections.

3) `SectionHeaderTable->Sections` is now optional. No `Sections` is the same as
   `Sections: []` (I think it avoids a confusion).
4) Using of `NoHeaders` together with `Sections`/`Excluded` is not allowed.
5) It is possible to use the `Excluded` key without the `Sections` key now (in this case
   `Excluded` must contain all sections).
6) `SectionHeaderTable:` or `SectionHeaderTable: []` is not allowed.
7) When the `SectionHeaderTable` key is present, we still require all sections to be
   present in `Sections` and `Excluded` lists. No changes here, we are still strict.

Differential revision: https://reviews.llvm.org/D81655
2020-06-15 12:43:16 +03:00
..
benchmarks
bindings
cmake [cmake] Don't pass -z discard-unused to Illumos ld 2020-06-12 09:56:42 +02:00
docs [WebAssembly] WebAssembly doesn't support "protected" visibility 2020-06-12 19:52:35 -07:00
examples
include [yaml2obj] - Introduce the "NoHeaders" key for "SectionHeaderTable" 2020-06-15 12:43:16 +03:00
lib [yaml2obj] - Introduce the "NoHeaders" key for "SectionHeaderTable" 2020-06-15 12:43:16 +03:00
projects
resources
runtimes [CMake][runtimes] Skip adding 2nd set of the same variables for a generic target 2020-06-15 09:59:27 +02:00
test [yaml2obj] - Introduce the "NoHeaders" key for "SectionHeaderTable" 2020-06-15 12:43:16 +03:00
tools Recommit "[DWARFYAML][debug_line] Replace `InitialLength` with `Format` and `Length`." 2020-06-13 23:39:11 +08:00
unittests [NewPM] Avoid redundant CGSCC run for updated SCC 2020-06-14 19:54:52 -07:00
utils [Lit] Pass through SSH_AUTH_SOCK from the surrounding environment 2020-06-12 13:59:29 -04:00
.clang-format
.clang-tidy
.gitattributes
.gitignore
CMakeLists.txt Automatically configure MLIR when flang is enabled 2020-05-27 07:31:49 +00:00
CODE_OWNERS.TXT Make myself code owner of InferAddressSpaces 2020-06-08 21:26:01 -04:00
CREDITS.TXT
LICENSE.TXT
LLVMBuild.txt
README.txt
RELEASE_TESTERS.TXT
configure
llvm.spec.in

README.txt

The LLVM Compiler Infrastructure
================================

This directory and its subdirectories contain source code for LLVM,
a toolkit for the construction of highly optimized compilers,
optimizers, and runtime environments.

LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.

Please see the documentation provided in docs/ for further
assistance with LLVM, and in particular docs/GettingStarted.rst for getting
started with LLVM and docs/README.txt for an overview of LLVM's
documentation setup.

If you are writing a package for LLVM, see docs/Packaging.rst for our
suggestions.