PowerPC64 dynreloc miscount failure

Alan Modra amodra@gmail.com
Fri Feb 1 07:43:00 GMT 2013


On Thu, Jan 31, 2013 at 03:43:43PM +0000, Nick Clifton wrote:
>   Solves the problem.  At least for the test case provided.  I suspect
>   however that you would prefer a slightly more elegant solution than
>   this, but please let me know if you think that the patch is OK.

Yes, I would prefer a patch that doesn't segfault on h == NULL.  ;-)

This problem is a result of the PR13177 fix, which clears def_regular
and ref_regular in order to have elf_output_extsym strip symbols
defined in shared libraries and only used in garbage collected
sections.  I considered correcting the test in dec_dynrel_count to
cope with this, but it's a lot simpler just to disable the error.

I'll commit this after testing with a gcc bootstrap.

	* elf64-ppc.c (dec_dynrel_count): Don't error when
	elf_gc_sweep_symbol clears def_regular.

Index: bfd/elf64-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.402
diff -u -p -r1.402 elf64-ppc.c
--- bfd/elf64-ppc.c	31 Jan 2013 06:28:46 -0000	1.402
+++ bfd/elf64-ppc.c	1 Feb 2013 06:39:53 -0000
@@ -7056,14 +7056,15 @@ dec_dynrel_count (bfd_vma r_info,
 	  void *vpp = &elf_section_data (sec)->local_dynrel;
 	  pp = (struct elf_dyn_relocs **) vpp;
 	}
-
-      /* elf_gc_sweep may have already removed all dyn relocs associated
-	 with local syms for a given section.  Don't report a dynreloc
-	 miscount.  */
-      if (*pp == NULL)
-	return TRUE;
     }
 
+  /* elf_gc_sweep may have already removed all dyn relocs associated
+     with local syms for a given section.  Also, symbol flags are
+     changed by elf_gc_sweep_symbol, confusing the test above.  Don't
+     report a dynreloc miscount.  */
+  if (*pp == NULL && info->gc_sections)
+    return TRUE;
+
   while ((p = *pp) != NULL)
     {
       if (p->sec == sec)

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list