[PATCH] D31672: [LLD][ELF] Fix ARM TLS global dynamic TlsOffsetRel for non-preemptible symbols

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 5 09:27:31 PDT 2017


peter.smith updated this revision to Diff 94244.
peter.smith added a comment.

I think at least some of the difficulty in understanding the code here is that there are too many somewhat arbitrary ARM and Mips specific bits of code here. I've updated the diff to split handleNoRelaxTlsRelocation() into an ARM and Mips specific function, this allows us to take out some of the special cases.

In the ARM case I've kept the relocation in Target as it allows the same relocation code to be given to the AddTlsReloc function.

I've also found out why the Body.isPreemptible() is for! When we are writing the module index we should only write a 1 if we know the symbol came from the executable. In the case when we are linking an executable but the TLS Symbol is defined in a Shared Library we still need a dynamic relocation for the module index.

Does this make the code any easier to follow? A relatively short but fairly complete description of ARM TLS can be found in Section 3 of http://infocenter.arm.com/help/topic/com.arm.doc.ihi0045e/IHI0045E_ABI_addenda.pdf


https://reviews.llvm.org/D31672

Files:
  ELF/Relocations.cpp
  ELF/Target.cpp
  arm-tls-gd-nonpreemptible.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31672.94244.patch
Type: text/x-patch
Size: 8409 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170405/63f84d28/attachment.bin>


More information about the llvm-commits mailing list