[ORC][ORC_RT][AArch64] Implement TLS descriptor in ELFNixPlatform.
authorSunho Kim <ksunhokim123@gmail.com>
Wed, 6 Jul 2022 11:12:22 +0000 (20:12 +0900)
committerSunho Kim <ksunhokim123@gmail.com>
Wed, 6 Jul 2022 11:12:22 +0000 (20:12 +0900)
commit30b6c51f515e633d6a798ddb82d4591d597670e9
tree69f7a18bd502754406605f0f269baed891e8917c
parent5d8077565e4196efdd4ed525a64c11a96d5aa5dd
[ORC][ORC_RT][AArch64] Implement TLS descriptor in ELFNixPlatform.

Implements TLS descriptor relocations in JITLink ELF/AARCH64 backend and support the relevant runtime functions in ELFNixPlatform.

Unlike traditional TLS model, TLS descriptor model requires linker to return the "offset" from thread pointer via relocaiton not the actual pointer to thread local variable. There is no public libc api for adding new allocations to TLS block dynamically which thread pointer points to. So, we support this by taking delta from thread base pointer to the actual thread local variable in our allocated section.

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D128601
compiler-rt/lib/orc/CMakeLists.txt
compiler-rt/lib/orc/elfnix_platform.cpp
compiler-rt/lib/orc/elfnix_tls.aarch64.S [new file with mode: 0644]
compiler-rt/test/orc/TestCases/Linux/aarch64/trivial-tls.S [new file with mode: 0644]
llvm/include/llvm/ExecutionEngine/JITLink/aarch64.h
llvm/lib/ExecutionEngine/JITLink/ELF_aarch64.cpp
llvm/lib/ExecutionEngine/JITLink/aarch64.cpp
llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp