This is an archive of the discontinued LLVM Phabricator instance.

[yaml2obj] - Allow overriding the sh_size field.
ClosedPublic

Authored by grimar on Jul 9 2019, 4:42 AM.

Details

Summary

There is no way to set broken sh_size field currently
for sections. It can be usefull for writing the
test cases. (I am going to use it in one of the futher patches).

It depends on D64472.

Diff Detail

Repository
rL LLVM

Event Timeline

grimar created this revision.Jul 9 2019, 4:42 AM
grimar added a comment.Jul 9 2019, 4:43 AM

May be it worth to split this into two patches? I am not sure.

May be it worth to split this into two patches? I am not sure.

Seems to me like there's nothing relating the sh_size overriding to the broken entry size? So yes, they should be different patches.

include/llvm/ObjectYAML/ELFYAML.h
148 ↗(On Diff #208641)

Delete the word "anyhow".

lib/ObjectYAML/ELFYAML.cpp
916 ↗(On Diff #208641)

Delete "an"

test/tools/yaml2obj/elf-override-shsize.yaml
1 ↗(On Diff #208641)

I wonder whether it's worth a test case with both Size and ShSize being set? It would show that the appropriate number of zeroes is written, but the sh_size field is changed. You could show the right number of zeroes are written by having non-zero section data from other sections before and after the broken section.

77 ↗(On Diff #208641)

What about a case where the content is smaller than the ShSize?

grimar planned changes to this revision.Jul 10 2019, 1:43 AM
grimar updated this revision to Diff 208907.Jul 10 2019, 3:12 AM
grimar marked 6 inline comments as done.
grimar edited the summary of this revision. (Show Details)
  • Addressed review comments.
test/tools/yaml2obj/elf-override-shsize.yaml
1 ↗(On Diff #208641)

Done.

77 ↗(On Diff #208641)

Done.

jhenderson accepted this revision.Jul 10 2019, 4:43 AM

LGTM, with one nit.

test/tools/yaml2obj/elf-override-shsize.yaml
108 ↗(On Diff #208907)

Delete "the"

This revision is now accepted and ready to land.Jul 10 2019, 4:43 AM
MaskRay accepted this revision.Jul 10 2019, 5:43 AM
This revision was automatically updated to reflect the committed changes.
grimar marked an inline comment as done.
Herald added a project: Restricted Project. · View Herald TranscriptJul 11 2019, 5:59 AM