This is an archive of the discontinued LLVM Phabricator instance.

[ELF][MIPS] - Explicitly list supported relocations for MIPS target.
ClosedPublic

Authored by arichardson on Jan 12 2017, 8:57 AM.

Details

Summary

Do the same thing as x86 (D28564) also for MIPS.

I am not sure whether the R_MIPS_TLS_* cases are correct but it
matches the previous behaviour.

Event Timeline

arichardson retitled this revision from to [ELF][MIPS] - Explicitly list supported relocations for MIPS target..
arichardson updated this object.
arichardson added reviewers: grimar, ruiu, atanasyan.
grimar added inline comments.Jan 12 2017, 9:01 AM
ELF/Target.cpp
2052

That 2 lines looks have a chance to return R_PC now:

if (&S == ElfSym<ELFT>::MipsGpDisp)
      return R_PC;

what is different from previous logic.
Is it correct ?

atanasyan accepted this revision.Jan 12 2017, 11:04 AM
atanasyan edited edge metadata.

LGTM

ELF/Target.cpp
2034

We handle these relocations specifically in the MipsTargetInfo<ELFT>::relocateOne. We can introduce new expression type and adjust the relocation values in the getRelocTargetVA, but I think that is too much.

2052

In fact it is not possible to get R_MIPS_HIGHER and R_MIPS_HIGHEST against _gp_disp symbol in a real application. Probably the best choice is to show an error if any relocations except R_MIPS_HI16/LO16 has _gp_disp as a target. But for now the code above is okay.

This revision is now accepted and ready to land.Jan 12 2017, 11:04 AM
ruiu accepted this revision.Jan 12 2017, 12:27 PM
ruiu edited edge metadata.

LGTM

ELF/Target.cpp
2034

Then please remove this FIXME.

2051–2052

Sort lines.

grimar edited edge metadata.Aug 17 2017, 2:36 AM

Looks it was forgotten and not committed.

atanasyan closed this revision.Sep 21 2017, 7:44 AM

Superseded by commit rL313882.