]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[ARC] Fixes TLS failures related to tls-align.
authorCupertino Miranda <cmiranda@synopsys.com>
Wed, 1 Aug 2018 16:22:07 +0000 (17:22 +0100)
committerClaudiu Zissulescu <claziss@gmail.com>
Thu, 15 Nov 2018 15:27:39 +0000 (17:27 +0200)
This patch fixes glibc testcase in nptl/tls-align.

bfd/
2018-08-01  Cupertino Miranda <cmiranda@synopsys.com>

* arc-got.h (relocate_fix_got_relocs_for_got_info): Changed, fixed
    TCB_SIZE offsize to include section alignment.
* elf32-arc.c (arc_special_overflow_checks): Likewise.

include/
2018-08-01  Cupertino Miranda <cmiranda@synopsys.com>

* arc-reloc.def (ARC_TLS_LE_32): Updated reloc formula.

bfd/ChangeLog
bfd/arc-got.h
bfd/elf32-arc.c
include/ChangeLog
include/elf/arc-reloc.def

index 14e4107326cc5c4579f62cdca3065955f4c3581f..b26e53135cb8955884ecd191c12b990b986593bf 100644 (file)
@@ -1,3 +1,12 @@
+2018-11-15  Claudiu Zissulescu  <claziss@synopsys.com>
+
+       Backport from mainline
+       2018-08-01  Cupertino Miranda <cmiranda@synopsys.com>
+       * arc-got.h (relocate_fix_got_relocs_for_got_info): Changed, fixed
+       TCB_SIZE offsize to include section alignment.
+       * elf32-arc.c (arc_special_overflow_checks): Likewise.
+
+
 2018-11-15  Claudiu Zissulescu  <claziss@synopsys.com>
 
        Backport from mainline
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));
index 052765ebdb85a2fd54e97b122d0bfb2a88e2adfa..d11b773adc54e0fd39e526239de33d7461d438ca 100644 (file)
@@ -1202,7 +1202,8 @@ arc_special_overflow_checks (const struct arc_relocation_data reloc_data,
 #define _SDA_BASE_ (bfd_signed_vma) (reloc_data.sdata_begin_symbol_vma)
 #define TLS_REL (bfd_signed_vma) \
   ((elf_hash_table (info))->tls_sec->output_section->vma)
-#define TLS_TBSS (8)
+#define TLS_TBSS (align_power(TCB_SIZE, \
+                 reloc_data.sym_section->alignment_power))
 
 #define none (0)
 
index 7decb4fd7b8c6e5c69645763fdb99a6a5e21e022..e0b82bc338681f93e625d86575cd0f3f9f69f57f 100644 (file)
@@ -1,3 +1,9 @@
+2018-11-15  Claudiu Zissulescu  <claziss@synopsys.com>
+
+       Backport from mainline
+       2018-08-01  Cupertino Miranda <cmiranda@synopsys.com>
+       * arc-reloc.def (ARC_TLS_LE_32): Updated reloc formula.
+
 2018-07-18  Nick Clifton  <nickc@redhat.com>
 
        2.31.1 Release point.
index a6db724da94871b13035538370fbb24b2e702926..e1c69c9d70c69b4b04fd402a4cc6315c5698b414 100644 (file)
@@ -489,7 +489,7 @@ ARC_RELOC_HOWTO(ARC_TLS_LE_32, 75, \
                 32, \
                 replace_word32, \
                 dont, \
-                ( ME ( ( ( ( S + A ) + TCB_SIZE ) - TLS_REL ) ) ))
+               ( ME ( ( ( ( S + A ) + TLS_TBSS ) - TLS_REL ) ) ))
 
 ARC_RELOC_HOWTO(ARC_S25W_PCREL_PLT, 76, \
                 2, \