[PATCH] D27213: [LLD][ARM] Add support for static TLS to ARM

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 29 07:00:43 PST 2016


peter.smith created this revision.
peter.smith added reviewers: ruiu, rafael, atanasyan.
peter.smith added a subscriber: llvm-commits.
Herald added subscribers: rengolin, aemerson.

Building on top of https://reviews.llvm.org/D27158 this adds support static linking for ARM TLS.

To do this we add support for the module index relocation R_ARM_DTPMOD32 to be resolved at static link time. The module index for the executable is always 1 so this is trivial to resolve.

The logic in handleNoRelaxTlsRelocation remains the same for Mips as it has its own custom GOT writing code. For ARM we add the module index relocation to the GOT when it can be resolved statically.

In addition to this change I noticed that the type of the RelExpr for the TlsGotRel should be R_TLS and not R_ABS as we need to include the size of the thread control block in the calculation. I wrote a comment in Phab yesterday on https://reviews.llvm.org/D27158 but it doesn't look like it got submitted, my apologies for the mixup.

Addresses the TLS part of PR30218.


https://reviews.llvm.org/D27213

Files:
  ELF/Relocations.cpp
  ELF/Target.cpp
  test/ELF/arm-tls-norelax-gd-le.s
  test/ELF/arm-tls-norelax-ie-le.s
  test/ELF/arm-tls-norelax-ld-le.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27213.79553.patch
Type: text/x-patch
Size: 6125 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161129/fdea7744/attachment.bin>


More information about the llvm-commits mailing list