Blame SOURCES/gcc48-rh1278872.patch

56d343
2013-07-25  Sterling Augustine  <saugustine@google.com>
56d343
56d343
	* dwarf2out.c (size_of_pubnames): Move code to...
56d343
	(include_pubname_in_output): ...here.  New.
56d343
	(output_pubnames): Call include_pubname_in_output.  Move assertion.
56d343
56d343
--- gcc/dwarf2out.c	(revision 201254)
56d343
+++ gcc/dwarf2out.c	(revision 201255)
56d343
@@ -7806,6 +7806,30 @@ unmark_all_dies (dw_die_ref die)
56d343
       unmark_all_dies (AT_ref (a));
56d343
 }
56d343
 
56d343
+/* Calculate if the entry should appear in the final output file.  It may be
56d343
+   from a pruned a type.  */
56d343
+
56d343
+static bool
56d343
+include_pubname_in_output (vec<pubname_entry, va_gc> *table, pubname_entry *p)
56d343
+{
56d343
+  if (table == pubname_table)
56d343
+    {
56d343
+      /* Enumerator names are part of the pubname table, but the parent
56d343
+	 DW_TAG_enumeration_type die may have been pruned.  Don't output
56d343
+	 them if that is the case.  */
56d343
+      if (p->die->die_tag == DW_TAG_enumerator && !p->die->die_mark)
56d343
+	return false;
56d343
+
56d343
+      /* Everything else in the pubname table is included.  */
56d343
+      return true;
56d343
+    }
56d343
+
56d343
+  /* The pubtypes table shouldn't include types that have been
56d343
+     pruned.  */
56d343
+  return (p->die->die_offset != 0
56d343
+	  || !flag_eliminate_unused_debug_types);
56d343
+}
56d343
+
56d343
 /* Return the size of the .debug_pubnames or .debug_pubtypes table
56d343
    generated for the compilation unit.  */
56d343
 
56d343
@@ -7818,9 +7842,7 @@ size_of_pubnames (vec
56d343
 
56d343
   size = DWARF_PUBNAMES_HEADER_SIZE;
56d343
   FOR_EACH_VEC_ELT (*names, i, p)
56d343
-    if (names != pubtype_table
56d343
-	|| p->die->die_offset != 0
56d343
-	|| !flag_eliminate_unused_debug_types)
56d343
+    if (include_pubname_in_output (names, p))
56d343
       size += strlen (p->name) + DWARF_OFFSET_SIZE + 1;
56d343
 
56d343
   size += DWARF_OFFSET_SIZE;
56d343
@@ -8999,22 +9021,14 @@ output_pubnames (vec
56d343
 
56d343
   FOR_EACH_VEC_ELT (*names, i, pub)
56d343
     {
56d343
-      /* Enumerator names are part of the pubname table, but the parent
56d343
-         DW_TAG_enumeration_type die may have been pruned.  Don't output
56d343
-         them if that is the case.  */
56d343
-      if (pub->die->die_tag == DW_TAG_enumerator && !pub->die->die_mark)
56d343
-        continue;
56d343
-
56d343
-      /* We shouldn't see pubnames for DIEs outside of the main CU.  */
56d343
-      if (names == pubname_table)
56d343
-	gcc_assert (pub->die->die_mark);
56d343
-
56d343
-      if (names != pubtype_table
56d343
-	  || pub->die->die_offset != 0
56d343
-	  || !flag_eliminate_unused_debug_types)
56d343
+      if (include_pubname_in_output (names, pub))
56d343
 	{
56d343
 	  dw_offset die_offset = pub->die->die_offset;
56d343
 
56d343
+	  /* We shouldn't see pubnames for DIEs outside of the main CU.  */
56d343
+	  if (names == pubname_table)
56d343
+	    gcc_assert (pub->die->die_mark);
56d343
+
56d343
 	  /* If we're putting types in their own .debug_types sections,
56d343
 	     the .debug_pubtypes table will still point to the compile
56d343
 	     unit (not the type unit), so we want to use the offset of