Page MenuHomePhabricator

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

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.

The codegen backend now emits a "canonical" [1] set of R_SPARC_HH22, R_SPARC_HM10, R_SPARC_LM22 and R_SPARC_LO10 relocations, there are no functional changes.

[1] https://docs.oracle.com/cd/E36784_01/html/E36858/gmadr.html

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.