This is an archive of the discontinued LLVM Phabricator instance.

[ELF2][MIPS] Support R_MIPS_CALL16 relocation
ClosedPublic

Authored by atanasyan on Nov 24 2015, 5:57 AM.

Details

Reviewers
ruiu
rafael
Summary

R_MIPS_CALL16 relocation provides the same result as R_MIPS_GOT16 relocation but does not need to check the result on overflow and should reject local symbol as a target.

The patch adds new argument to the relocateOne method. It is a pointer to SymbolBody. In case of local symbol it is nullptr.

Diff Detail

Repository
rL LLVM

Event Timeline

atanasyan updated this revision to Diff 41035.Nov 24 2015, 5:57 AM
atanasyan retitled this revision from to [ELF2][MIPS] Support R_MIPS_CALL16 relocation.
atanasyan updated this object.
atanasyan added reviewers: ruiu, rafael.
atanasyan set the repository for this revision to rL LLVM.
atanasyan added a project: lld.
atanasyan added a subscriber: llvm-commits.
ruiu edited edge metadata.Nov 24 2015, 12:00 PM

Did you pass a SymbolBody just for checking if its a global symbol? Do we need that? (We don't have to find all ABI violations -- if input is garbage, output may be garbage.)

In D14950#296022, @ruiu wrote:

Did you pass a SymbolBody just for checking if its a global symbol? Do we need that? (We don't have to find all ABI violations -- if input is garbage, output may be garbage.)

In this patch I pass a SymbolBody just for the checking. But later I will anyway need to recognize _gp_disp symbol and handle relocations against this symbol in a special way.

ruiu added a comment.Nov 24 2015, 2:33 PM

Could you remove that error checking and the parameters from this patch and move that to the other patch in which you use that?

atanasyan updated this revision to Diff 41107.Nov 24 2015, 9:09 PM
atanasyan edited edge metadata.

Removed checking for R_MIPS_CALL16 target symbol (local/global). Now we just calculate and apply the relocation.

ruiu accepted this revision.Nov 25 2015, 10:25 AM
ruiu edited edge metadata.

LGTM with this fix.

ELF/Target.cpp
116

Please remove this function from this patch.

This revision is now accepted and ready to land.Nov 25 2015, 10:25 AM
atanasyan added inline comments.Nov 25 2015, 12:29 PM
ELF/Target.cpp
116

Hmm, if I remove this function I will always get R_MIPS_GOT16 relocation type into the relocateOne routine and so I will not be able to process R_MIPS_GOT16 and R_MIPS_CALL16 differently. In case of R_MIPS_CALL16 I should not check the result on overflow.

ruiu added a comment.Nov 25 2015, 12:33 PM

LGTM

ELF/Target.cpp
116

I'm sorry, I overlooked "override" and thought that this is a dead function.

atanasyan closed this revision.Nov 25 2015, 1:07 PM

Closed by commit rL254092.