Page MenuHomePhabricator

[AMDGPU] Fix offset for REL32_HI relocs
ClosedPublic

Authored by foad on Tue, Sep 1, 6:56 AM.

Details

Summary

The addend in a REL32 reloc needs to be adjusted to account for the
offset from the PC value returned by the s_getpc instruction to the
point where the reloc is applied. This was being done correctly for
(GOTPC)REL32_LO but not for (GOTPC)REL32_HI. This will only make a
difference if the target symbol happens to get loaded almost exactly
a multiple of 4G away from the relocated instructions.

Diff Detail

Event Timeline

foad created this revision.Tue, Sep 1, 6:56 AM
Herald added a project: Restricted Project. · View Herald Transcript
foad requested review of this revision.Tue, Sep 1, 6:56 AM
foad edited reviewers, added: arsenm, rampitec, nhaehnle, sebastian-ne; removed: jdoerfert.Tue, Sep 1, 6:57 AM
Flakebi added a subscriber: Flakebi.Tue, Sep 1, 7:55 AM

Wow, good catch. Looks good to me.

arsenm added a comment.Tue, Sep 1, 7:57 AM

I think the lo32/hi32 relocations are a broken concept to begin with and we should be using an expression to extract the low / high bits of the 64-bit relocations

rampitec accepted this revision.Tue, Sep 1, 10:51 AM

LGTM even if we need to rework it as Matt suggests.

This revision is now accepted and ready to land.Tue, Sep 1, 10:51 AM
This revision was automatically updated to reflect the committed changes.