]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/binutils-tumbl.git/commitdiff
PR ld/15056
authorAlan Modra <amodra@bigpond.net.au>
Thu, 31 Jan 2013 07:35:26 +0000 (07:35 +0000)
committerAlan Modra <amodra@bigpond.net.au>
Thu, 31 Jan 2013 07:35:26 +0000 (07:35 +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 6f48211b6330b7fa8cadf9815120bea66197ad6d..e103fbf4558d8ffb4858961ff71e627b02ae0d3b 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 (build_plt_stub): Correct plt stub branch to glink.
index 9dff9e52838417923d2022dae4ac2b4791fa9ed0..ce3773a8cd7e0d35fba5a4278cfdb32d97480ca7 100644 (file)
@@ -1858,11 +1858,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 e14afaf970fa2b1ea58b3dceb04048c824caca30..716fa56c7d50f3c33d010358a8139f3b65259dfc 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 df63569ed3e04f9bf85f8359a555f6bfffa606b1..1dd1fe62d903da5494a35468c7d161863958071d 100644 (file)
@@ -2078,11 +2078,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);