This is an archive of the discontinued LLVM Phabricator instance.

[yaml2obj] - Allow empty SectionHeaderTable definitions.
ClosedPublic

Authored by grimar on Jan 25 2021, 3:47 AM.

Details

Summary

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.

Diff Detail

Event Timeline

grimar created this revision.Jan 25 2021, 3:47 AM
grimar requested review of this revision.Jan 25 2021, 3:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 25 2021, 3:47 AM

Hi guys.
I am sorry for pinging this too early, but I am planning a ~6 weeks vacation starting from 1st of february
and I wonder if there is something I can do for this to land it or if there are any concerns about this change?

jhenderson accepted this revision.Jan 27 2021, 1:49 AM

LGTM.

Hi guys.
I am sorry for pinging this too early, but I am planning a ~6 weeks vacation starting from 1st of february
and I wonder if there is something I can do for this to land it or if there are any concerns about this change?

No problem. Somehow this slipped off my review pile, so I hadn't seen it. Let me know if there are any other reviews I haven't done by the end of the day.

llvm/test/tools/yaml2obj/ELF/section-headers.yaml
155

I think this sounds better English to me, though I can't place specifically what was wrong before!

This revision is now accepted and ready to land.Jan 27 2021, 1:49 AM
grimar added a comment.EditedJan 27 2021, 1:50 AM

LGTM.

Hi guys.
I am sorry for pinging this too early, but I am planning a ~6 weeks vacation starting from 1st of february
and I wonder if there is something I can do for this to land it or if there are any concerns about this change?

No problem. Somehow this slipped off my review pile, so I hadn't seen it. Let me know if there are any other reviews I haven't done by the end of the day.

Nothing else. This is the only one. Thanks!

This revision was automatically updated to reflect the committed changes.
grimar marked an inline comment as done.