This is an archive of the discontinued LLVM Phabricator instance.

[obj2yaml] - Teach tool to dump SHT_NULL sections.
ClosedPublic

Authored by grimar on Jul 24 2019, 8:36 AM.

Details

Summary

Recently an advanced support of SHT_NULL sections
was implemented in yaml2obj.

This patch adds a corresponding support to obj2yaml.

Diff Detail

Repository
rL LLVM

Event Timeline

grimar created this revision.Jul 24 2019, 8:36 AM
grimar planned changes to this revision.Jul 25 2019, 1:28 AM

It contains parts of the D65214. I'll reupload.

grimar updated this revision to Diff 211691.Jul 25 2019, 1:30 AM
  • Now the diff is correct.
MaskRay added inline comments.Jul 25 2019, 1:45 AM
tools/obj2yaml/elf2yaml.cpp
245 ↗(On Diff #211691)
if (&Sec == &Sections[0] && memchr(&Sec, 0, sizeof Sec) == nullptr)
  break;
grimar marked 2 inline comments as done.Jul 25 2019, 2:35 AM
grimar added inline comments.
tools/obj2yaml/elf2yaml.cpp
245 ↗(On Diff #211691)

memchr searches for the first value, e.g. for the first 0 in your sample.
But I want to check here that all bytes in a range are '0', i.e. I need
to find the first non-zero value, it doesn't seem memchr can help here?

MaskRay added inline comments.Jul 25 2019, 3:21 AM
tools/obj2yaml/elf2yaml.cpp
245 ↗(On Diff #211691)

Sorry about the memchr suggestion.. This part looks good.

if (&Sec == &Sections[0]) {

grimar updated this revision to Diff 211707.Jul 25 2019, 3:33 AM
grimar marked 2 inline comments as done.
  • Addressed review comment.
  • Renamed the test case.
tools/obj2yaml/elf2yaml.cpp
245 ↗(On Diff #211691)

Nevermind. I was also a bit confused about that there seems to be no any standart function for that.

jhenderson added inline comments.Jul 26 2019, 3:43 AM
test/tools/obj2yaml/elf-null-section.yaml
45 ↗(On Diff #211707)

Nit: section with a non-zero index

88 ↗(On Diff #211707)

"with index 0"

116 ↗(On Diff #211707)

begining -> beginning

117 ↗(On Diff #211707)

of the section list

any non-null fields.

grimar updated this revision to Diff 212138.Jul 29 2019, 2:43 AM
grimar marked 4 inline comments as done.
  • Addressed review comments.
MaskRay accepted this revision.Jul 30 2019, 9:16 AM
This revision is now accepted and ready to land.Jul 30 2019, 9:16 AM
grimar planned changes to this revision.Jul 31 2019, 12:30 AM

Seems somehow I uploaded a diff from D65278 here last time. Sorry about that, I'll reupload the correct diff soon.

grimar updated this revision to Diff 212516.Jul 31 2019, 12:34 AM
  • Updated the diff.
This revision is now accepted and ready to land.Jul 31 2019, 12:34 AM
grimar requested review of this revision.Jul 31 2019, 12:34 AM
MaskRay accepted this revision.Jul 31 2019, 4:58 AM
This revision is now accepted and ready to land.Jul 31 2019, 4:58 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptAug 5 2019, 6:18 AM