[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
Wed Jun 10 09:17:47 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.

We have an issue currently. The following YAML piece just ignores the `Excluded` key.

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

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.
I suggest the simple fix that makes the next logic to work properly:

1. When there is a "Sections: []", but no "Excluded" key, we omit all section headers.
2. When there is a "Sections: []" and non-empty "Excluded", then the latter is validated properly and must list all sections. This can be used to create an objects which has no section headers except the null section.


https://reviews.llvm.org/D81581

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81581.269873.patch
Type: text/x-patch
Size: 4039 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200610/f952d921/attachment.bin>


More information about the llvm-commits mailing list