This is an archive of the discontinued LLVM Phabricator instance.

[ELF][MIPS] Add lazy relocation support for MIPS
ClosedPublic

Authored by atanasyan on Feb 8 2016, 5:41 AM.

Details

Summary

The patch adds lazy relocation support for MIPS and R_MIPS_26 relocation handing.

R_MIPS_26 relocation might require PLT entry creation. In that case it is fully supported by the patch. But if the relocation target is a local symbol we need to use a different expression to calculate the relocation result. This case is not implemented yet because there is no method to get know the kind of relocation target in the relocateOne routine.

Diff Detail

Repository
rL LLVM

Event Timeline

atanasyan updated this revision to Diff 47179.Feb 8 2016, 5:41 AM
atanasyan retitled this revision from to [ELF][MIPS] Add lazy relocation support for MIPS.
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 added inline comments.Feb 9 2016, 4:56 PM
ELF/Target.cpp
201–202 ↗(On Diff #47179)

indentation

1455 ↗(On Diff #47179)

SA + A? "SA" means S+A, so it implies that an addend is added twice, or we have two different addends.

1463 ↗(On Diff #47179)

Ditto

1468–1492 ↗(On Diff #47179)

I'd reduce the code duplication by

write32<E>(Buf, 0x3c1c0000);     // lui ...
write32<E>(Buf + 4, 0x8f990000); // lw ...
write32<E>(Buf + 8, ...
1504–1520 ↗(On Diff #47179)

Ditto

1539–1541 ↗(On Diff #47179)
return Type == R_MIPS_GOT16 || Type == R_MIPS_CALL16 || needsPlt(Type, S);
atanasyan updated this revision to Diff 47430.Feb 10 2016, 2:20 AM
  • Fixed indentation
  • Solved the problem with ambiguous SA argument name
  • Removed PLT records code duplication
  • Made needsGot shorter
ruiu accepted this revision.Feb 10 2016, 11:18 AM
ruiu edited edge metadata.

LGTM

This revision is now accepted and ready to land.Feb 10 2016, 11:18 AM
This revision was automatically updated to reflect the committed changes.