Blame binutils-2.23.52.0.1-check-regular-ifunc-refs.patch

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