Blame SOURCES/gcc48-rh1278872.patch

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