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
... why don't you add
here? (I'm not saying that this long if-elseif-elseif is easy to read, but consistency matters.