This is an archive of the discontinued LLVM Phabricator instance.

[ELF][MIPS] Create GOT entries for R_MIPS_REL32 dynamic relocations
ClosedPublic

Authored by atanasyan on Apr 10 2016, 11:31 PM.

Details

Summary

MIPS ABI turns using of GOT and dynamic relocations inside out. While regular ABI uses dynamic relocations to fill up GOT entries MIPS ABI requires dynamic linker to fills up GOT entries using specially sorted dynamic symbol table. This affects even dynamic relocations against symbols which do not require GOT entries creation explicitly, i.e. do not have any GOT-relocations. So if a preemptible symbol has a dynamic relocation we anyway have to create a GOT entry for it.

If a non-preemptible symbol has a dynamic relocation against it, dynamic linker takes it st_value, adds offset and writes down result of the dynamic relocation. In case of preemptible symbol dynamic linker performs symbol resolution, writes the symbol value to the GOT entry and reads the GOT entry when it needs to perform a dynamic relocation.

Diff Detail

Repository
rL LLVM

Event Timeline

atanasyan updated this revision to Diff 53194.Apr 10 2016, 11:31 PM
atanasyan retitled this revision from to [ELF][MIPS] Create GOT entries for R_MIPS_REL32 dynamic relocations.
atanasyan updated this object.
atanasyan added reviewers: rafael, ruiu.
atanasyan set the repository for this revision to rL LLVM.
atanasyan added a project: lld.
atanasyan added a subscriber: llvm-commits.
atanasyan updated this revision to Diff 53840.Apr 14 2016, 9:32 PM

Rebase the patch.

rafael edited edge metadata.Apr 20 2016, 12:51 PM
rafael added a subscriber: rafael.

sorry, this got buried on my email list. Taking a look now.

rafael accepted this revision.Apr 20 2016, 1:03 PM
rafael edited edge metadata.

This is really crazy, but LGTM.

This revision is now accepted and ready to land.Apr 20 2016, 1:03 PM
This revision was automatically updated to reflect the committed changes.