]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - bfd/arc-got.h
[ARC] Fixes TLS failures related to tls-align.
[thirdparty/binutils-gdb.git] / bfd / arc-got.h
index 81ce88fe21a039ddc822f6c4fdefc3fd19b8b817..e32d9b30e313510a6b65771dcb89666403efe439 100644 (file)
@@ -24,6 +24,9 @@
 
 #define TCB_SIZE (8)
 
+#define        align_power(addr, align)        \
+  (((addr) + ((bfd_vma) 1 << (align)) - 1) & (-((bfd_vma) 1 << (align))))
+
 enum tls_type_e
 {
   GOT_UNKNOWN = 0,
@@ -359,7 +362,10 @@ relocate_fix_got_relocs_for_got_info (struct got_entry **     list_p,
 
                bfd_put_32 (output_bfd,
                            sym_value - sec_vma
-                           + (elf_hash_table (info)->dynamic_sections_created ? 0 : TCB_SIZE),
+                           + (elf_hash_table (info)->dynamic_sections_created
+                              ? 0
+                              : (align_power (TCB_SIZE,
+                                              tls_sec->alignment_power))),
                            htab->sgot->contents + entry->offset
                            + (entry->existing_entries == TLS_GOT_MOD_AND_OFF
                               ? 4 : 0));