This is an archive of the discontinued LLVM Phabricator instance.

[lld] [ELF] Initial implementation of TLSDESC relocation handling
AbandonedPublic

Authored by zatrazz on Apr 5 2016, 7:26 AM.

Details

Reviewers
ruiu
rafael
Summary

This patch implements the initial lld support for TLSDESC relocation
types. They have lazy relocation nature, so require entries in got.plt.
Each one is double sized. Also special Plt entry with resolver is created in
addition to single got entry. A module that uses lazy TLSDESC relocations
must define next two entries in dynamic section:

  • DT_TLSDESC_PLT - Location of PLT entry for TLS descriptor resolver calls.
  • DT_TLSDESC_GOT - Location of GOT entry used by TLS descriptor resolver PLT entry.

More information can be found in "Thread-Local Storage Descriptors for IA32 and
AMD64/EM64T" and "Thread-Local Storage Descriptors for the ARM platform"
(http://www.fsfla.org/~lxoliva/writeups/TLS/RFC-TLSDESC-x86.txt,
http://www.fsfla.org/~lxoliva/writeups/TLS/RFC-TLSDESC-ARM.txt)

Diff Detail

Event Timeline

zatrazz updated this revision to Diff 52686.Apr 5 2016, 7:26 AM
zatrazz retitled this revision from to [lld] [ELF/AArch64] Implemented set of R_AARCH64_TLSDESC_* relocations.
zatrazz updated this object.
zatrazz added reviewers: ruiu, rafael.
zatrazz set the repository for this revision to rL LLVM.
zatrazz added a project: lld.
zatrazz added subscribers: llvm-commits, rengolin.
emaste added a subscriber: emaste.Apr 5 2016, 8:01 AM
ruiu edited edge metadata.Apr 5 2016, 4:02 PM

Understanding the details about AArch64 TLS descriptors would take time. Is this a minimal smallest patch? If you can split it up into smaller steps, it would be awesome.

In D18790#392816, @ruiu wrote:

Understanding the details about AArch64 TLS descriptors would take time. Is this a minimal smallest patch? If you can split it up into smaller steps, it would be awesome.

Just a remark besides the AArch64TargetInfo specific bits (TLS plt layout)
the tlsdesc support is not really aarch64 specific. Although clang does not
support it for x86_64, you can add enable it with gcc by using -mtls-dialect=gnu2.

About the patch, I am trying to come up with a simples part but I think the
only bit would be remove aarch64 parts and move to another part. I will do it
and update this one.

zatrazz updated this revision to Diff 52830.Apr 6 2016, 12:06 PM
zatrazz edited edge metadata.
zatrazz removed rL LLVM as the repository for this revision.

Updated patch with the following modifications:

  • Remove aarch64 specific bits (I will send in a different patch);
  • Remove the 'Tail' std::vector usage and replaced by vector of vectors.

I did added any testcase for this since no target implements TLSDESC relocation
support yet. I will send the aarch64 bits along with a testcase.

zatrazz retitled this revision from [lld] [ELF/AArch64] Implemented set of R_AARCH64_TLSDESC_* relocations to [lld] [ELF] Initial implementation of TLSDESC relocation handling.Apr 6 2016, 12:07 PM
zatrazz updated this object.
zatrazz abandoned this revision.Apr 11 2016, 5:34 AM