This is an archive of the discontinued LLVM Phabricator instance.

[llvm-readelf] - Make GNU style dumping of invalid SHT_GNU_verdef be consistent with LLVM style.
ClosedPublic

Authored by grimar on Nov 27 2019, 3:00 AM.

Details

Summary

When we dump SHT_GNU_verdef section that has sh_link that references a non-existent section,
llvm-readobj reports a warning and continues dump, but llvm-readelf fails with a error.

This patch fixes the issue and opens road for futher follow-ups for
improving the printGNUVersionSectionProlog().

Diff Detail

Event Timeline

grimar created this revision.Nov 27 2019, 3:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 27 2019, 3:00 AM

Looks okay to me. What does GNU do in this situation?

Looks okay to me. What does GNU do in this situation?

It prints:

readelf: Warning: Section 1 has an out of range sh_link value of 255

Version definition section '.gnu.version_d' contains 0 entries:
  Addr: 0x0000000000000000  Offset: 0x000040  Link: 255 (<corrupt>)

Looks okay to me. What does GNU do in this situation?

It prints:

readelf: Warning: Section 1 has an out of range sh_link value of 255

Version definition section '.gnu.version_d' contains 0 entries:
  Addr: 0x0000000000000000  Offset: 0x000040  Link: 255 (<corrupt>)

Okay, thanks. Should we maybe print <corrupt> too, instead of <invalid>? I don't mind either way.

grimar planned changes to this revision.Nov 27 2019, 4:32 AM

Looks okay to me. What does GNU do in this situation?

It prints:

readelf: Warning: Section 1 has an out of range sh_link value of 255

Version definition section '.gnu.version_d' contains 0 entries:
  Addr: 0x0000000000000000  Offset: 0x000040  Link: 255 (<corrupt>)

Okay, thanks. Should we maybe print <corrupt> too, instead of <invalid>? I don't mind either way.

I'll change to "corrupt" for consistency.

MaskRay accepted this revision.Nov 27 2019, 9:13 AM

LG once you change <invalid> to <corrupt>

grimar updated this revision to Diff 231358.Nov 28 2019, 12:07 AM
  • Rebased, changed "<invalid>"->"<corrupt>"
This revision is now accepted and ready to land.Nov 28 2019, 12:07 AM
jhenderson accepted this revision.Nov 28 2019, 12:47 AM

LGTM too.

This revision was automatically updated to reflect the committed changes.