This is an archive of the discontinued LLVM Phabricator instance.

[SPARC] Recognize and handle the %lm(sym) operator
ClosedPublic

Authored by LemonBoy on Apr 8 2020, 8:52 AM.

Details

Summary

R_SPARC_LM22 is similar in spirit (and encoding and behaviour) to R_SPARC_HI22 but truncates the result instead of raising an error on overflow.

Diff Detail

Event Timeline

LemonBoy created this revision.Apr 8 2020, 8:52 AM
LemonBoy updated this revision to Diff 256054.Apr 8 2020, 10:02 AM

Applied the suggested clang-format diff.

Please don't change the style of the code, it messes up review and the full source. Please split the introduction and testing of the new relocation into one patch and using a different set of relocations to implement large code model. The latter part needs at least a test as well?

Functionally, it seems fine, but I'd prefer to look at the split patches first.

LemonBoy updated this revision to Diff 315538.Jan 8 2021, 3:46 PM
LemonBoy edited the summary of this revision. (Show Details)

Roll back to something simpler, let's only implement %lm and its encoding.

joerg accepted this revision.Feb 8 2021, 7:38 AM

LGTM.

I have one concern about sparc-relocations.s, but that is not specific to the change at hand. IMO we should also have a variant of all the relocations with a fixed values of sym to test that the right bits are actually set. That would also make comparing the fixup handling easier e.g. to GNU as.

This revision is now accepted and ready to land.Feb 8 2021, 7:38 AM
This revision was automatically updated to reflect the committed changes.