This is an archive of the discontinued LLVM Phabricator instance.

[ELF][MIPS] Support MIPS TLS relocations
ClosedPublic

Authored by atanasyan on Jun 22 2016, 5:34 AM.

Details

Summary

The patch adds one more partition to the MIPS GOT. This time it is for TLS related GOT entries. Such entries are located after 'local' and 'global' ones. We cannot get a final offset for these entries at the time of creation because we do not know size of 'local' and 'global' partitions. So we have to adjust the offset later using getMipsTlsOffset() method.

All MIPS TLS relocations which need GOT entries operates MIPS style GOT offset - 'offset from the GOT's beginning' - MipsGPOffset constant. That is why I add new types of relocation expressions.

One more difference from othe ABIs is that the MIPS ABI does not support any TLS relocation relaxations. I decided to make a separate function handleMipsTlsRelocation and put MIPS TLS relocation handling code there. It is similar to handleTlsRelocation routine and duplicates its code. But it allows to make the code cleaner and prevent pollution of the handleTlsRelocation by MIPS 'if' statements.

Diff Detail

Repository
rL LLVM

Event Timeline

atanasyan updated this revision to Diff 61535.Jun 22 2016, 5:34 AM
atanasyan retitled this revision from to [ELF][MIPS] Support MIPS TLS 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.
ruiu accepted this revision.Jun 22 2016, 10:06 PM
ruiu edited edge metadata.

LGTM

ELF/InputSection.cpp
224 ↗(On Diff #61535)

No need to add an addend?

ELF/OutputSections.cpp
140 ↗(On Diff #61535)

"the the"

ELF/Target.cpp
1711–1715 ↗(On Diff #61535)

Merge these two ifs and elses.

This revision is now accepted and ready to land.Jun 22 2016, 10:06 PM
This revision was automatically updated to reflect the committed changes.