Nick Clifton 7e18cb
*** ../binutils-2.23.52.0.1.orig/bfd/elf-ifunc.c	2013-04-17 15:53:49.662586029 +0100
Nick Clifton 7e18cb
--- bfd/elf-ifunc.c	2013-04-17 15:55:55.269589511 +0100
Nick Clifton 7e18cb
*************** _bfd_elf_allocate_ifunc_dyn_relocs (stru
Nick Clifton 7e18cb
*** 187,209 ****
Nick Clifton 7e18cb
  
Nick Clifton 7e18cb
    htab = elf_hash_table (info);
Nick Clifton 7e18cb
  
Nick Clifton 7e18cb
    /* Support garbage collection against STT_GNU_IFUNC symbols.  */
Nick Clifton 7e18cb
    if (h->plt.refcount <= 0 && h->got.refcount <= 0)
Nick Clifton 7e18cb
      {
Nick Clifton 7e18cb
-       /* When building shared library, we need to handle the case
Nick Clifton 7e18cb
-          where it is marked with regular reference, but not non-GOT
Nick Clifton 7e18cb
- 	 reference.  It may happen if we didn't see STT_GNU_IFUNC
Nick Clifton 7e18cb
- 	 symbol at the time when checking relocations.  */
Nick Clifton 7e18cb
-       if (info->shared
Nick Clifton 7e18cb
- 	  && !h->non_got_ref
Nick Clifton 7e18cb
- 	  && h->ref_regular)
Nick Clifton 7e18cb
- 	for (p = *head; p != NULL; p = p->next)
Nick Clifton 7e18cb
- 	  if (p->count)
Nick Clifton 7e18cb
- 	    {
Nick Clifton 7e18cb
- 	      h->non_got_ref = 1;
Nick Clifton 7e18cb
- 	      goto keep;
Nick Clifton 7e18cb
- 	    }
Nick Clifton 7e18cb
- 
Nick Clifton 7e18cb
        h->got = htab->init_got_offset;
Nick Clifton 7e18cb
        h->plt = htab->init_plt_offset;
Nick Clifton 7e18cb
        *head = NULL;
Nick Clifton 7e18cb
--- 187,206 ----
Nick Clifton 7e18cb
  
Nick Clifton 7e18cb
    htab = elf_hash_table (info);
Nick Clifton 7e18cb
  
Nick Clifton 7e18cb
+   /* When building a shared library, we need to handle the case where it is
Nick Clifton 7e18cb
+      marked with a regular reference, but not a non-GOT reference since the
Nick Clifton 7e18cb
+      non-GOT reference bit may not be set here.  */
Nick Clifton 7e18cb
+   if (info->shared && !h->non_got_ref && h->ref_regular)
Nick Clifton 7e18cb
+     for (p = *head; p != NULL; p = p->next)
Nick Clifton 7e18cb
+       if (p->count)
Nick Clifton 7e18cb
+ 	{
Nick Clifton 7e18cb
+ 	  h->non_got_ref = 1;
Nick Clifton 7e18cb
+ 	  goto keep;
Nick Clifton 7e18cb
+ 	}
Nick Clifton 7e18cb
+ 
Nick Clifton 7e18cb
    /* Support garbage collection against STT_GNU_IFUNC symbols.  */
Nick Clifton 7e18cb
    if (h->plt.refcount <= 0 && h->got.refcount <= 0)
Nick Clifton 7e18cb
      {
Nick Clifton 7e18cb
        h->got = htab->init_got_offset;
Nick Clifton 7e18cb
        h->plt = htab->init_plt_offset;
Nick Clifton 7e18cb
        *head = NULL;