Content for TLS_IE_GOT not written to .got.
authorCupertino Miranda <cmiranda@synopsys.com>
Tue, 12 Jul 2016 14:31:40 +0000 (16:31 +0200)
committerCupertino Miranda <cmiranda@synopsys.com>
Fri, 26 Aug 2016 10:09:17 +0000 (12:09 +0200)
When no dynamic relocation was generated the .got content would not be
updated for the TLS_IE_GOT relocation addresses.

bfd/ChangeLog:

Cupertino Miranda  <cmiranda@synopsys.com>

* arc-got.h (relocate_fix_got_relocs_for_got_info): Fixed addresses in
debug comments. Fixed address in .got related to TLS_IE_GOT dynamic
relocation.

ld/ChangeLog:

Cupertino Miranda  <cmiranda@synopsys.com>

* testsuite/ld-arc/tls_ie-01.s: Added to verify associated fix.
* testsuite/ld-arc/tls_ie-01.d: Likewise

bfd/ChangeLog
bfd/arc-got.h
ld/ChangeLog
ld/testsuite/ld-arc/tls_ie-01.d [new file with mode: 0644]
ld/testsuite/ld-arc/tls_ie-01.s [new file with mode: 0644]

index b7206aecac5f0427dcb9f3961fa8d3ea02d873ce..66e65c37288fa0c9eee2e7fba7ef74582feb429d 100644 (file)
@@ -1,3 +1,9 @@
+2016-08-26  Cupertino Miranda  <cmiranda@synopsys.com>
+
+       * arc-got.h (relocate_fix_got_relocs_for_got_info): Fixed addresses in
+       debug comments. Fixed address in .got related to TLS_IE_GOT dynamic
+       relocation.
+
 2016-08-26  Cupertino Miranda  <cmiranda@synopsys.com>
 
        * reloc.c: Fixed type in ARC_SECTOFF relocations. Added ARC_SDA_12
index 7c3cfd952d2430e583bcb551776ffb25bf2e0f47..9ac02957df61cb00d858c944f86633207b4026e8 100644 (file)
@@ -334,13 +334,15 @@ relocate_fix_got_relocs_for_got_info (struct got_entry **          list_p,
                               ? 4 : 0));
 
                ARC_DEBUG ("arc_info: FIXED -> %s value = %#lx "
-                          "@ %p, for symbol %s\n",
+                          "@ %lx, for symbol %s\n",
                           (entry->type == GOT_TLS_GD ? "GOT_TLS_GD" :
                            "GOT_TLS_IE"),
                           (long) (sym_value - sec_vma),
-                          htab->sgot->contents + entry->offset
-                          + (entry->existing_entries == TLS_GOT_MOD_AND_OFF
-                             ? 4 : 0),
+                          (long) (htab->sgot->output_section->vma
+                             + htab->sgot->output_offset->vma
+                             + entry->offset
+                             + (entry->existing_entries == TLS_GOT_MOD_AND_OFF
+                                ? 4 : 0)),
                           symbol_name);
              }
              break;
@@ -351,14 +353,22 @@ relocate_fix_got_relocs_for_got_info (struct got_entry **          list_p,
                bfd_vma ATTRIBUTE_UNUSED sec_vma
                  = tls_sec->output_section->vma;
 
+               bfd_put_32 (output_bfd,
+                           sym_value - sec_vma,
+                           htab->sgot->contents + entry->offset
+                           + (entry->existing_entries == TLS_GOT_MOD_AND_OFF
+                              ? 4 : 0));
+
                ARC_DEBUG ("arc_info: FIXED -> %s value = %#lx "
                           "@ %p, for symbol %s\n",
                           (entry->type == GOT_TLS_GD ? "GOT_TLS_GD" :
                            "GOT_TLS_IE"),
                           (long) (sym_value - sec_vma),
-                          htab->sgot->contents + entry->offset
-                          + (entry->existing_entries == TLS_GOT_MOD_AND_OFF
-                             ? 4 : 0),
+                          (long) (htab->sgot->output_section->vma
+                             + htab->sgot->output_offset->vma
+                             + entry->offset
+                             + (entry->existing_entries == TLS_GOT_MOD_AND_OFF
+                                ? 4 : 0)),
                           symbol_name);
              }
              break;
index fccaea3bb18e32efe32ed42d4414003e8b48ec36..76c28631ff15015d34f067a448afb0c4779c8c7d 100644 (file)
@@ -1,3 +1,8 @@
+2016-08-26  Cupertino Miranda  <cmiranda@synopsys.com>
+
+       * testsuite/ld-arc/tls_ie-01.s: Added to verify associated fix.
+       * testsuite/ld-arc/tls_ie-01.d: Likewise
+
 2016-08-26  Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
        * emultempl/armelf.em (in_implib_filename): Declare and initialize new
diff --git a/ld/testsuite/ld-arc/tls_ie-01.d b/ld/testsuite/ld-arc/tls_ie-01.d
new file mode 100644 (file)
index 0000000..8d53ef5
--- /dev/null
@@ -0,0 +1,9 @@
+#source: tls_ie-01.s
+#as: -mcpu=arc700
+#ld:
+#objdump: -s -j .got
+
+[^:]+:     file format elf32-littlearc
+
+Contents of section \.got:
+ [0-9a-f]+ 00000000 04000000 .+
diff --git a/ld/testsuite/ld-arc/tls_ie-01.s b/ld/testsuite/ld-arc/tls_ie-01.s
new file mode 100644 (file)
index 0000000..74f40ed
--- /dev/null
@@ -0,0 +1,10 @@
+       .tls_common foo,4,4
+       .tls_common bar,4,4
+
+       .text
+       .align 4
+
+        .global __start
+__start:
+       ld r14, [pcl, @foo@tlsie]
+       ld r15, [pcl, @bar@tlsie]
This page took 0.032103 seconds and 4 git commands to generate.