PR ld/15056
authorAlan Modra <amodra@gmail.com>
Thu, 31 Jan 2013 07:32:45 +0000 (07:32 +0000)
committerAlan Modra <amodra@gmail.com>
Thu, 31 Jan 2013 07:32:45 +0000 (07:32 +0000)
* elfxx-sparc.c (_bfd_sparc_elf_gc_mark_hook): Handle implicit
references to __tls_get_addr.
* elf32-tilpro.c (tilepro_elf_gc_mark_hook): Likewise.  Correct
vtinherit and vtentry reloc handling too.
* elfxx-tilegx.c (tilegx_elf_gc_mark_hook): As for tilepro.

bfd/ChangeLog
bfd/elf32-tilepro.c
bfd/elfxx-sparc.c
bfd/elfxx-tilegx.c

index 9598b6a50c458ebb53ada40c711b31e760d3008e..c53af4ba4897474684ee15c6a72e986ee55774b2 100644 (file)
@@ -1,3 +1,13 @@
+2013-01-31  Alan Modra  <amodra@gmail.com>
+           David S. Miller  <davem@davemloft.net>
+
+       PR ld/15056
+       * elfxx-sparc.c (_bfd_sparc_elf_gc_mark_hook): Handle implicit
+       references to __tls_get_addr.
+       * elf32-tilpro.c (tilepro_elf_gc_mark_hook): Likewise.  Correct
+       vtinherit and vtentry reloc handling too.
+       * elfxx-tilegx.c (tilegx_elf_gc_mark_hook): As for tilepro.
+
 2013-01-31  Alan Modra  <amodra@gmail.com>
 
        * elf64-ppc.c (ppc_stub_name): Trim off trailing "+0".
index fc49e2b816d8ef7d12e981f01fbfb0273daf38e2..db37403b7f8c17736125bce6b258fc1af917cb58 100644 (file)
@@ -1868,11 +1868,33 @@ tilepro_elf_gc_mark_hook (asection *sec,
   if (h != NULL)
     {
       switch (ELF32_R_TYPE (rel->r_info))
-      {
-      case R_TILEPRO_GNU_VTINHERIT:
-      case R_TILEPRO_GNU_VTENTRY:
-       break;
-      }
+       {
+       case R_TILEPRO_GNU_VTINHERIT:
+       case R_TILEPRO_GNU_VTENTRY:
+         return NULL;
+       }
+    }
+
+  /* FIXME: The test here, in check_relocs and in relocate_section
+     dealing with TLS optimization, ought to be !info->executable.  */
+  if (info->shared)
+    {
+      switch (ELF32_R_TYPE (rel->r_info))
+       {
+       case R_TILEPRO_TLS_GD_CALL:
+         /* This reloc implicitly references __tls_get_addr.  We know
+            another reloc will reference the same symbol as the one
+            on this reloc, so the real symbol and section will be
+            gc marked when processing the other reloc.  That lets
+            us handle __tls_get_addr here.  */
+         h = elf_link_hash_lookup (elf_hash_table (info), "__tls_get_addr",
+                                   FALSE, FALSE, TRUE);
+         BFD_ASSERT (h != NULL);
+         h->mark = 1;
+         if (h->u.weakdef != NULL)
+           h->u.weakdef->mark = 1;
+         sym = NULL;
+       }
     }
 
   return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
index 196d566aa99d5512142cd7f15ce18abec7399bd1..9684ffd7a4d9ef294769cbc4a605bdfd3d705b02 100644 (file)
@@ -1873,6 +1873,29 @@ _bfd_sparc_elf_gc_mark_hook (asection *sec,
        return NULL;
       }
 
+  /* FIXME: The test here, in check_relocs and in relocate_section
+     dealing with TLS optimization, ought to be !info->executable.  */
+  if (info->shared)
+    {
+      switch (SPARC_ELF_R_TYPE (rel->r_info))
+       {
+       case R_SPARC_TLS_GD_CALL:
+       case R_SPARC_TLS_LDM_CALL:
+         /* This reloc implicitly references __tls_get_addr.  We know
+            another reloc will reference the same symbol as the one
+            on this reloc, so the real symbol and section will be
+            gc marked when processing the other reloc.  That lets
+            us handle __tls_get_addr here.  */
+         h = elf_link_hash_lookup (elf_hash_table (info), "__tls_get_addr",
+                                   FALSE, FALSE, TRUE);
+         BFD_ASSERT (h != NULL);
+         h->mark = 1;
+         if (h->u.weakdef != NULL)
+           h->u.weakdef->mark = 1;
+         sym = NULL;
+       }
+    }
+
   return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
 }
 
index b28d1a875a5dc608bb2d8dd7198655655d969f98..cd92bf9a8752340b86df92023abfb91f85d0cbc3 100644 (file)
@@ -2107,11 +2107,33 @@ tilegx_elf_gc_mark_hook (asection *sec,
   if (h != NULL)
     {
       switch (TILEGX_ELF_R_TYPE (rel->r_info))
-      {
-      case R_TILEGX_GNU_VTINHERIT:
-      case R_TILEGX_GNU_VTENTRY:
-       break;
-      }
+       {
+       case R_TILEGX_GNU_VTINHERIT:
+       case R_TILEGX_GNU_VTENTRY:
+         return NULL;
+       }
+    }
+
+  /* FIXME: The test here, in check_relocs and in relocate_section
+     dealing with TLS optimization, ought to be !info->executable.  */
+  if (info->shared)
+    {
+      switch (TILEGX_ELF_R_TYPE (rel->r_info))
+       {
+       case R_TILEGX_TLS_GD_CALL:
+         /* This reloc implicitly references __tls_get_addr.  We know
+            another reloc will reference the same symbol as the one
+            on this reloc, so the real symbol and section will be
+            gc marked when processing the other reloc.  That lets
+            us handle __tls_get_addr here.  */
+         h = elf_link_hash_lookup (elf_hash_table (info), "__tls_get_addr",
+                                   FALSE, FALSE, TRUE);
+         BFD_ASSERT (h != NULL);
+         h->mark = 1;
+         if (h->u.weakdef != NULL)
+           h->u.weakdef->mark = 1;
+         sym = NULL;
+       }
     }
 
   return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
This page took 0.031902 seconds and 4 git commands to generate.