diff mbox

[google/4_9] Add a new flag bit to .debug_gnu_pubnames entries

Message ID CAHACq4rLYTJU-Wyt31Gfb=_rk6KK3QP0DjrphLnAJayaW6qaSw@mail.gmail.com
State New
Headers show

Commit Message

Cary Coutant Sept. 11, 2014, 11:58 p.m. UTC
This patch is for the google/gcc-4_9 branch only.

Use one of the reserved bits in the flag byte to tell gold which
symbols in the pubnames table can be entered just once in the
.gdb_index (rather than listing all CUs in which a given symbol
appears). We set this bit for class/struct types and namespaces only.

-cary



2014-09-11  Cary Coutant  <ccoutant@google.com>

gcc/
        * dwarf2out.c (output_pubname): Use a reserved bit in the flags
        byte to tell gold it's OK to keep just one CU in the CU list
        for this index entry.
diff mbox

Patch

Index: dwarf2out.c
===================================================================
--- dwarf2out.c (revision 215195)
+++ dwarf2out.c (working copy)
@@ -9181,6 +9181,16 @@  add_pubtype (tree decl, dw_die_ref die)
     }
 }

+/* We use one of the reserved bits in the flags byte to tell the linker
+   which index entries do not need to list all CUs that contain the symbol.  */
+
+#define GDB_INDEX_RESERVED_SINGLE_CU 8
+#define GDB_INDEX_RESERVED_SET_VALUE(cu_index, value) \
+  do { \
+    (cu_index) |= (((value) & GDB_INDEX_RESERVED_MASK) \
+                   << GDB_INDEX_RESERVED_SHIFT); \
+  } while (0)
+
 /* Output a single entry in the pubnames table.  */

 static void
@@ -9227,6 +9237,9 @@  output_pubname (dw_offset die_offset, pu
           GDB_INDEX_SYMBOL_STATIC_SET_VALUE(flags, is_static);
           break;
         case DW_TAG_namespace:
+          GDB_INDEX_SYMBOL_KIND_SET_VALUE(flags, GDB_INDEX_SYMBOL_KIND_TYPE);
+         GDB_INDEX_RESERVED_SET_VALUE(flags, GDB_INDEX_RESERVED_SINGLE_CU);
+         break;
         case DW_TAG_imported_declaration:
           GDB_INDEX_SYMBOL_KIND_SET_VALUE(flags, GDB_INDEX_SYMBOL_KIND_TYPE);
           break;
@@ -9236,6 +9249,7 @@  output_pubname (dw_offset die_offset, pu
         case DW_TAG_union_type:
         case DW_TAG_enumeration_type:
           GDB_INDEX_SYMBOL_KIND_SET_VALUE(flags, GDB_INDEX_SYMBOL_KIND_TYPE);
+         GDB_INDEX_RESERVED_SET_VALUE(flags, GDB_INDEX_RESERVED_SINGLE_CU);
           if (!is_cxx () && !is_java ())
            GDB_INDEX_SYMBOL_STATIC_SET_VALUE(flags, 1);
           break;