Enable traditional TLS accesses on arm64
Handle generic DTPMOD/DTPREL relocations on arm64. Expose __tls_get_addr.
Bug: http://b/123385182
Test: manual -- compile code using arm64 gcc -mtls-dialect=trad
Change-Id: I99d2faae35d1ebffc1be8de50b4a1f5e21b14348
diff --git a/libc/libc.map.txt b/libc/libc.map.txt
index 0bcf761..0cab83d 100644
--- a/libc/libc.map.txt
+++ b/libc/libc.map.txt
@@ -1485,6 +1485,7 @@
__mempcpy_chk;
__open64_2;
__openat64_2;
+ __tls_get_addr; # arm64
call_once;
cnd_broadcast;
cnd_destroy;
diff --git a/linker/linker.cpp b/linker/linker.cpp
index e39da81..df7dd40 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -3162,10 +3162,6 @@
*reinterpret_cast<ElfW(Addr)*>(reloc) = tpoff;
}
break;
-
-#if !defined(__aarch64__)
- // Omit support for DTPMOD/DTPREL on arm64, at least until
- // http://b/123385182 is fixed. arm64 uses TLSDESC instead.
case R_GENERIC_TLS_DTPMOD:
count_relocation(kRelocRelative);
MARK(rel->r_offset);
@@ -3190,7 +3186,6 @@
reinterpret_cast<void*>(sym_addr + addend), sym_name);
*reinterpret_cast<ElfW(Addr)*>(reloc) = sym_addr + addend;
break;
-#endif // !defined(__aarch64__)
#if defined(__aarch64__)
// Bionic currently only implements TLSDESC for arm64. This implementation should work with