This is an archive of the discontinued LLVM Phabricator instance.

[yaml2obj] - Allow setting cutom Flags for implicit sections.
ClosedPublic

Authored by grimar on Jun 11 2019, 7:08 AM.

Details

Summary

With this patch we get ability to set any flags we want
for implicit sections defined in YAML.

Diff Detail

Event Timeline

grimar created this revision.Jun 11 2019, 7:08 AM

Do we have test cases anywhere for the sections' flags when they aren't described in the YAML?

test/tools/yaml2obj/strtab-implicit-sections-flags.yaml
2

Nit: add "the" before Flags.

6

and -> and the

33–34

I'd probably just remove the rest of the sentence from "and make .strtab ..."

test/tools/yaml2obj/symtab-implicit-sections-flags.yaml
2

Same comments apply to this test as the other test.

grimar added a comment.EditedJun 13 2019, 3:20 AM

Do we have test cases anywhere for the sections' flags when they aren't described in the YAML?

When I stop adding SHF_ALLOC flag for .dynsym/.dynstr and run the tests, I see 6 are failing:

Failing Tests (6):
    LLVM :: tools/yaml2obj/dynamic-symbols.yaml
    LLVM :: tools/yaml2obj/dynsymtab-implicit-sections-size-content.yaml
    LLVM :: tools/yaml2obj/elf-symtab-shinfo.yaml
    LLVM :: tools/yaml2obj/explicit-dynsym-no-dynstr.yaml
    LLVM :: tools/yaml2obj/strtab-implicit-sections-flags.yaml
    LLVM :: tools/yaml2obj/symtab-implicit-sections-flags.yaml

The first 4 are intended to check different things and the last 2 are added by this patch.
dynamic-symbols.yaml checks that .dynsym/.dynstr has SHF_ALLOC when they are not described in it's YAML explicitly.

If I start adding SHF_ALLOC for .strtab/.symtab (in case their flags are not described explicitly)
then the following tests are failing:

Failing Tests (5):
    LLVM :: tools/yaml2obj/elf-symtab-shinfo.yaml
    LLVM :: tools/yaml2obj/strtab-implicit-sections-flags.yaml
    LLVM :: tools/yaml2obj/strtab-implicit-sections-size-content.yaml
    LLVM :: tools/yaml2obj/symtab-implicit-sections-flags.yaml
    LLVM :: tools/yaml2obj/symtab-implicit-sections-size-content.yaml

In all of these test cases these sections are described in yaml (but flags are not). I.e. seems we never test their default
flags when they aren't explicitly described in the YAML.

I'll update the strtab-implicit-sections-flags.yaml and symtab-implicit-sections-flags.yaml to fix that piece.

grimar updated this revision to Diff 204473.Jun 13 2019, 3:34 AM
grimar marked 4 inline comments as done.
  • Addressed review comments.
This revision is now accepted and ready to land.Jun 13 2019, 8:48 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJun 14 2019, 3:58 AM