[PATCH] D16201: [ELF/AArch64] - Implemented set of R_AARCH64_TLSDESC_* relocations.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 14 11:00:01 PST 2016


grimar created this revision.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: llvm-commits, grimar.
Herald added subscribers: rengolin, aemerson.

This patch implements next relocations:
R_AARCH64_TLSDESC_ADR_PAGE21, R_AARCH64_TLSDESC_LD64_LO12_NC, R_AARCH64_TLSDESC_ADD_LO12_NC, R_AARCH64_TLSDESC_CALL.

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)

Sample app to see them on AArch64 is:
__thread int foo;
int main() {
  foo = 5;
}
aarch64-linux-gnu-g++ -fPIC test.cpp -S -o test.s

http://reviews.llvm.org/D16201

Files:
  ELF/InputSection.cpp
  ELF/OutputSections.cpp
  ELF/OutputSections.h
  ELF/Target.cpp
  ELF/Target.h
  ELF/Writer.cpp
  test/ELF/aarch64-tls-desc.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16201.44902.patch
Type: text/x-patch
Size: 18718 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160114/b8035ad0/attachment-0001.bin>


More information about the llvm-commits mailing list