This is an archive of the discontinued LLVM Phabricator instance.

[llvm-readobj] - Don't abort when dumping dynamic relocations when an object has both REL and RELA.
ClosedPublic

Authored by grimar on Jul 6 2020, 8:16 AM.

Details

Summary

Currently, llvm-readobj calls report_fatal_error when an object has
both REL and RELA dynamic relocations.

llvm-readelf is able to handle this case properly. This patch adds such a test case
and adjusts the llvm-readobj code to follow (and be consistent with its own RELR and PLTREL cases).

Diff Detail

Event Timeline

grimar created this revision.Jul 6 2020, 8:16 AM
Herald added a project: Restricted Project. · View Herald Transcript
jhenderson added inline comments.Jul 7 2020, 1:29 AM
llvm/test/tools/llvm-readobj/ELF/broken-dynamic-reloc.test
499–512

The input here is a little subtle, i.e. reusing the same data for both REL and RELA relocations. Perhaps it would be clearer to have them point at different sections? If that's not possible, it might be worth pointing out how this works in a comment.

grimar updated this revision to Diff 275993.Jul 7 2020, 4:32 AM
grimar marked 2 inline comments as done.
  • Addressed review comments.
llvm/test/tools/llvm-readobj/ELF/broken-dynamic-reloc.test
499–512

Fixed.

jhenderson accepted this revision.Jul 7 2020, 5:18 AM

LGTM, with one suggestion.

llvm/test/tools/llvm-readobj/ELF/broken-dynamic-reloc.test
499

Consider specifying on offset for one of these relocations, to distinguish it from the other, and show that the same region isn't being read for both now.

This revision is now accepted and ready to land.Jul 7 2020, 5:18 AM
This revision was automatically updated to reflect the committed changes.