This is an archive of the discontinued LLVM Phabricator instance.

[llvm-readobj][test] - Remove unused Offset key from reloc-types-*.test tests
ClosedPublic

Authored by grimar on Mar 15 2020, 6:29 AM.

Details

Summary

This is a follow-up for D75608.
The Offset property is unused in these tests and can be removed to reduce them.

This patch does nothing with reloc-types-elf-i386.test which has a different
structure (it kind of tests the Offset, though the testing looks excessive to me).
I think we might want to split it later probably.

Diff Detail

Event Timeline

grimar created this revision.Mar 15 2020, 6:29 AM

I am kind of concerned that this will make tests on REL targets "more invalid". This is fine with our use of llvm-readobj because the addends aren't used. @jhenderson What do you think?

I am kind of concerned that this will make tests on REL targets "more invalid". This is fine with our use of llvm-readobj because the addends aren't used. @jhenderson What do you think?

I'm not sure I understand what you mean by "more invalid". I guess the idea is that the default offset is 0, so REL targets would read their addends from offset 0 rather than whereever they were before. I think this is fine - note that the gABI explicitly allows for multiple relocations to patch the same location.

jhenderson accepted this revision.Mar 16 2020, 6:44 AM

LGTM, but please wait for @MaskRay.

This revision is now accepted and ready to land.Mar 16 2020, 6:44 AM
MaskRay accepted this revision.Mar 16 2020, 7:40 AM

LGTM, but please wait for @MaskRay.

Quote http://www.sco.com/developers/gabi/latest/ch4.reloc.html

If multiple consecutive relocation records are applied to the same relocation location (r_offset), they are composed instead of being applied independently, as described above. By consecutive, we mean that the relocation records are contiguous within a single relocation section. By composed, we mean that the standard application described above is modified as follows:

  • In all but the last relocation operation of a composed sequence, the result of the relocation expression is retained, rather than having part extracted and placed in the relocated field. The result is retained at full pointer precision of the applicable ABI processor supplement.
  • In all but the first relocation operation of a composed sequence, the addend used is the retained result of the previous relocation operation, rather than that implied by the relocation type.

"the addend used is the retained result of the previous relocation operation" This is what I meant by "more invalid".

Though, I think it is ok because llvm-readobj does not modify file contents.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 17 2020, 3:00 AM
Herald added a subscriber: jrtc27. · View Herald Transcript