[PATCH] D81581: [yaml2obj] - Fix the issues with SectionHeaderTable when Sections key is empty.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 11 02:26:09 PDT 2020


grimar planned changes to this revision.
grimar added a comment.

In D81581#2085349 <https://reviews.llvm.org/D81581#2085349>, @MaskRay wrote:

> Is it possible to use an omitted `Sections` (rather than an empty (`Sections: []`)) to represent that all section headers except `Excluded` should be present?


The current logic is that all sections must be included either in "Sections" or in "Excluded" list. We error out when them are not.
It was done because of implicit sections, like `.strtab`, `.shstrtab` which are easy to forget about. I think we should keep this rule.

Probably we can go with the following set of rules:

1. "Sections: []" means all sections should be excluded, except the implicit null section. It is not allowed with "Excluded".
2. When `Sections` is not empty, then all section names (except the null section) must present in "Sections" + "Excluded" lists. (we have it already).
3. When there is a `SectionHeaderTable` key and both "Sections" and "Excluded" keys are omitted, then do not create a section header table.

With that way (1) is similar to the regular "Sections" list, where we also create an implicit null section when there are no sections listed.

I'll try to implement this set of rules to check how it looks like.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81581/new/

https://reviews.llvm.org/D81581





More information about the llvm-commits mailing list