Add -f[no-]skeleton-type-units flag to control whether GCC
generates skeleton type units.

This patch is for the google/gcc-4_8 branch. I will hold off
sending it upstream until we're certain that we will be disabling
skeleton type units, at which point, I'll just remove the
code instead of making it conditional on this flag.

OK to commit?

-cary


2014-05-12  Cary Coutant  <ccout...@google.com>

gcc/
        * dwarf2out.c (output_skeleton_debug_sections): Check
        -fskeleton-type-units flag.
        (output_comdat_type_unit): Likewise.
        (dwarf2out_finish): Likewise.
        * common.opt (fskeleton-type-units): New option.

Index: dwarf2out.c
===================================================================
--- dwarf2out.c (revision 208284)
+++ dwarf2out.c (working copy)
@@ -8978,7 +8978,7 @@ output_skeleton_debug_sections (dw_die_r
   ASM_OUTPUT_LABEL (asm_out_file, debug_skeleton_abbrev_section_label);
 
   output_die_abbrevs (SKELETON_COMP_DIE_ABBREV, comp_unit);
-  if (use_debug_types)
+  if (use_debug_types && flag_skeleton_type_units)
     output_die_abbrevs (SKELETON_TYPE_DIE_ABBREV, get_skeleton_type_unit ());
 
   dw2_asm_output_data (1, 0, "end of skeleton .debug_abbrev");
@@ -9043,7 +9043,7 @@ output_comdat_type_unit (comdat_type_nod
   unmark_dies (node->root_die);
 
 #if defined (OBJECT_FORMAT_ELF)
-  if (dwarf_split_debug_info)
+  if (dwarf_split_debug_info && flag_skeleton_type_units)
     {
       /* Produce the skeleton type-unit header.  */
       const char *secname = ".debug_types";
@@ -23930,7 +23930,8 @@ dwarf2out_finish (const char *filename)
       add_top_level_skeleton_die_attrs (main_comp_unit_die);
       add_AT_lineptr (main_comp_unit_die, DW_AT_GNU_addr_base,
                       debug_addr_section_label);
-      (void) get_skeleton_type_unit ();
+      if (flag_skeleton_type_units)
+        (void) get_skeleton_type_unit ();
       htab_traverse_noresize (debug_str_hash, index_string, &index);
     }
 
Index: common.opt
===================================================================
--- common.opt  (revision 208284)
+++ common.opt  (working copy)
@@ -1348,6 +1348,10 @@ floop-nest-optimize
 Common Report Var(flag_loop_optimize_isl) Optimization
 Enable the ISL based loop nest optimizer
 
+fskeleton-type-units
+Common Report Var(flag_skeleton_type_units) Init(1)
+Output skeleton .debug_types sections when using -gsplit-dwarf.
+
 fstrict-volatile-bitfields
 Common Report Var(flag_strict_volatile_bitfields) Init(-1)
 Force bitfield accesses to match their type width

Reply via email to