[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
Tue Apr 4 09:49:47 PDT 2017


peter.smith created this revision.
Herald added subscribers: rengolin, aemerson.

When the target of the TlsOffsetRel is non-preemptible we can write the offset directly into the GOT without needing a dynamic relocation. This is optional for dynamically linked executables but is required for static linking.

      

We used to rely on the GOTSection::writeTo member function to get the TLS offset of the symbol when writing the VA of the symbol. However in r288107 the GOTSection::writeTo was changed to only use relocations for writing values. Unfortunately we were missing the GOT relocation so all TLS offsets were being written as 0. This change adds the relocation to the GOT entry and a test case for non-0 offsets.

This was found as a result of investigating https://reviews.llvm.org/D31274


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.94086.patch
Type: text/x-patch
Size: 2964 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170404/2494c808/attachment.bin>


More information about the llvm-commits mailing list