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

Adhemerval Zanella via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 21 14:15:03 PDT 2016


zatrazz created this revision.
zatrazz added reviewers: ruiu, rafael.
zatrazz added subscribers: emaste, grimar, rengolin, llvm-commits.
zatrazz set the repository for this revision to rL LLVM.
zatrazz added a project: lld.
Herald added a subscriber: 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

PS: this patch is based on http://reviews.llvm.org/D16201

Repository:
  rL LLVM

http://reviews.llvm.org/D18330

Files:
  ELF/InputSection.cpp
  ELF/OutputSections.cpp
  ELF/OutputSections.h
  ELF/Symbols.cpp
  ELF/Symbols.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: D18330.51225.patch
Type: text/x-patch
Size: 32000 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160321/fa5745ca/attachment.bin>


More information about the llvm-commits mailing list