Merge changes I99d2faae,Ie98b7624
* changes:
Enable traditional TLS accesses on arm64
Renumber arm64 TLS to match GNU values
diff --git a/libc/include/bits/elf_arm64.h b/libc/include/bits/elf_arm64.h
index d838c0b..6bb8384 100644
--- a/libc/include/bits/elf_arm64.h
+++ b/libc/include/bits/elf_arm64.h
@@ -83,9 +83,9 @@
#define R_AARCH64_GLOB_DAT 1025 /* Create GOT entry. */
#define R_AARCH64_JUMP_SLOT 1026 /* Create PLT entry. */
#define R_AARCH64_RELATIVE 1027 /* Adjust by program base. */
-#define R_AARCH64_TLS_DTPREL64 1028 /* Module-relative offset. */
-#define R_AARCH64_TLS_DTPMOD64 1029 /* Module index. */
-#define R_AARCH64_TLS_TPREL64 1030 /* TP-relative offset. */
+#define R_AARCH64_TLS_DTPMOD 1028 /* Module index. */
+#define R_AARCH64_TLS_DTPREL 1029 /* Module-relative offset. */
+#define R_AARCH64_TLS_TPREL 1030 /* TP-relative offset. */
#define R_AARCH64_TLSDESC 1031 /* 16-byte descriptor: resolver func + arg. */
#define R_AARCH64_IRELATIVE 1032
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
diff --git a/linker/linker_relocs.h b/linker/linker_relocs.h
index 68191f9..1da5ebe 100644
--- a/linker/linker_relocs.h
+++ b/linker/linker_relocs.h
@@ -38,9 +38,9 @@
#define R_GENERIC_GLOB_DAT R_AARCH64_GLOB_DAT
#define R_GENERIC_RELATIVE R_AARCH64_RELATIVE
#define R_GENERIC_IRELATIVE R_AARCH64_IRELATIVE
-#define R_GENERIC_TLS_DTPMOD R_AARCH64_TLS_DTPMOD64
-#define R_GENERIC_TLS_DTPREL R_AARCH64_TLS_DTPREL64
-#define R_GENERIC_TLS_TPREL R_AARCH64_TLS_TPREL64
+#define R_GENERIC_TLS_DTPMOD R_AARCH64_TLS_DTPMOD
+#define R_GENERIC_TLS_DTPREL R_AARCH64_TLS_DTPREL
+#define R_GENERIC_TLS_TPREL R_AARCH64_TLS_TPREL
#define R_GENERIC_TLSDESC R_AARCH64_TLSDESC
#elif defined (__arm__)