Blame SOURCES/gcc48-rh1278872.patch

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