@@ -1012,6 +1012,10 @@ femit-class-debug-always
Common Report Var(flag_emit_class_debug_always) Init(0)
Do not suppress C++ class debug information.
+fdebug-types-section
+Common Report Var(flag_debug_types_section) Init(1)
+Output .debug_types section when using DWARF v4 debuginfo.
+
fexceptions
Common Report Var(flag_exceptions) Optimization
Enable exception handling
@@ -312,7 +312,8 @@ Objective-C and Objective-C++ Dialects}.
-fdump-final-insns=@var{file} @gol
-fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
-feliminate-dwarf2-dups -feliminate-unused-debug-types @gol
--feliminate-unused-debug-symbols -femit-class-debug-always @gol
+-feliminate-unused-debug-symbols -femit-class-debug-always
+-fdebug-types-section @gol
-fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report -fprofile-arcs @gol
-frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
-fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
@@ -4585,6 +4586,15 @@ normally emits debugging information for classes because using this
option will increase the size of debugging information by as much as a
factor of two.
+@item -fno-debug-types-section
+@opindex fno-types-section
+@opindex ftypes-section
+By default when using Dwarf v4 or higher type DIEs will be put into
+their own .debug_types section instead of making them part of the
+.debug_info section. It is more efficient to put them in a separate
+comdat sections since the linker will then be able to remove duplicates.
+But not all dwarf consumers support .debug_types sections yet.
+
@item -gstabs+
@opindex gstabs+
Produce debugging information in stabs format (if that is supported),
@@ -5795,6 +5795,16 @@ const struct gcc_debug_hooks dwarf2_debug_hooks =
representation is done after the entire program has been compiled.
The types below are used to describe the internal representation. */
+/* Whether to put type DIEs into their own section .debug_types instead
+ of making them part of the .debug_info section. Only supported for
+ Dwarf V4 or higher and the user didn't disable them through
+ -fno-debug-types-section. It is more efficient to put them in a
+ separate comdat sections since the linker will then be able to
+ remove duplicates. But not all tools support .debug_types sections
+ yet. */
+
+#define use_debug_types (dwarf_version >= 4 && flag_debug_types_section)
+
/* Various DIE's use offsets relative to the beginning of the
.debug_info section to refer to each other. */
@@ -5853,7 +5863,7 @@ typedef struct GTY((chain_circular ("%h.die_sib"))) die_struct {
char * GTY ((tag ("0"))) die_symbol;
comdat_type_node_ref GTY ((tag ("1"))) die_type_node;
}
- GTY ((desc ("dwarf_version >= 4"))) die_id;
+ GTY ((desc ("use_debug_types"))) die_id;
VEC(dw_attr_node,gc) * die_attr;
dw_die_ref die_parent;
dw_die_ref die_child;
@@ -8524,7 +8534,7 @@ print_die (dw_die_ref die, FILE *outfile)
fprintf (outfile, " offset: %ld", die->die_offset);
fprintf (outfile, " mark: %d\n", die->die_mark);
- if (dwarf_version >= 4 && die->die_id.die_type_node)
+ if (use_debug_types && die->die_id.die_type_node)
{
print_spaces (outfile);
fprintf (outfile, " signature: ");
@@ -8576,13 +8586,13 @@ print_die (dw_die_ref die, FILE *outfile)
case dw_val_class_die_ref:
if (AT_ref (a) != NULL)
{
- if (dwarf_version >= 4 && AT_ref (a)->die_id.die_type_node)
+ if (use_debug_types && AT_ref (a)->die_id.die_type_node)
{
fprintf (outfile, "die -> signature: ");
print_signature (outfile,
AT_ref (a)->die_id.die_type_node->signature);
}
- else if (dwarf_version < 4 && AT_ref (a)->die_id.die_symbol)
+ else if (! use_debug_types && AT_ref (a)->die_id.die_symbol)
fprintf (outfile, "die -> label: %s",
AT_ref (a)->die_id.die_symbol);
else
@@ -10539,7 +10549,7 @@ build_abbrev_table (dw_die_ref die)
if (AT_class (a) == dw_val_class_die_ref
&& AT_ref (a)->die_mark == 0)
{
- gcc_assert (dwarf_version >= 4 || AT_ref (a)->die_id.die_symbol);
+ gcc_assert (use_debug_types || AT_ref (a)->die_id.die_symbol);
set_AT_ref_external (a, 1);
}
@@ -10687,7 +10697,7 @@ size_of_die (dw_die_ref die)
we use DW_FORM_ref_addr. In DWARF2, DW_FORM_ref_addr
is sized by target address length, whereas in DWARF3
it's always sized as an offset. */
- if (dwarf_version >= 4)
+ if (use_debug_types)
size += DWARF_TYPE_SIGNATURE_SIZE;
else if (dwarf_version == 2)
size += DWARF2_ADDR_SIZE;
@@ -10773,7 +10783,7 @@ unmark_dies (dw_die_ref die)
{
dw_die_ref c;
- if (dwarf_version < 4)
+ if (! use_debug_types)
gcc_assert (die->die_mark);
die->die_mark = 0;
@@ -10972,7 +10982,7 @@ value_format (dw_attr_ref a)
return DW_FORM_flag;
case dw_val_class_die_ref:
if (AT_ref_external (a))
- return dwarf_version >= 4 ? DW_FORM_ref_sig8 : DW_FORM_ref_addr;
+ return use_debug_types ? DW_FORM_ref_sig8 : DW_FORM_ref_addr;
else
return DW_FORM_ref;
case dw_val_class_fde_ref:
@@ -11182,7 +11192,7 @@ output_die (dw_die_ref die)
/* If someone in another CU might refer to us, set up a symbol for
them to point to. */
- if (dwarf_version < 4 && die->die_id.die_symbol)
+ if (! use_debug_types && die->die_id.die_symbol)
output_die_symbol (die);
dw2_asm_output_data_uleb128 (die->die_abbrev, "(DIE (%#lx) %s)",
@@ -11321,7 +11331,7 @@ output_die (dw_die_ref die)
case dw_val_class_die_ref:
if (AT_ref_external (a))
{
- if (dwarf_version >= 4)
+ if (use_debug_types)
{
comdat_type_node_ref type_node =
AT_ref (a)->die_id.die_type_node;
@@ -12862,7 +12872,7 @@ modified_type_die (tree type, int is_const_type, int is_volatile_type,
}
else if (code == REFERENCE_TYPE)
{
- if (TYPE_REF_IS_RVALUE (type) && dwarf_version >= 4)
+ if (TYPE_REF_IS_RVALUE (type) && use_debug_types)
mod_type_die = new_die (DW_TAG_rvalue_reference_type, comp_unit_die (),
type);
else
@@ -20067,7 +20077,7 @@ gen_reference_type_die (tree type, dw_die_ref context_die)
{
dw_die_ref ref_die, scope_die = scope_die_for (type, context_die);
- if (TYPE_REF_IS_RVALUE (type) && dwarf_version >= 4)
+ if (TYPE_REF_IS_RVALUE (type) && use_debug_types)
ref_die = new_die (DW_TAG_rvalue_reference_type, scope_die, type);
else
ref_die = new_die (DW_TAG_reference_type, scope_die, type);
@@ -22153,7 +22163,7 @@ dwarf2out_source_line (unsigned int line, const char *filename,
static void
dwarf2out_start_source_file (unsigned int lineno, const char *filename)
{
- if (flag_eliminate_dwarf2_dups && dwarf_version < 4)
+ if (flag_eliminate_dwarf2_dups && ! use_debug_types)
{
/* Record the beginning of the file for break_out_includes. */
dw_die_ref bincl_die;
@@ -22177,7 +22187,7 @@ dwarf2out_start_source_file (unsigned int lineno, const char *filename)
static void
dwarf2out_end_source_file (unsigned int lineno ATTRIBUTE_UNUSED)
{
- if (flag_eliminate_dwarf2_dups && dwarf_version < 4)
+ if (flag_eliminate_dwarf2_dups && ! use_debug_types)
/* Record the end of the file for break_out_includes. */
new_die (DW_TAG_GNU_EINCL, comp_unit_die (), NULL);
@@ -22437,7 +22447,7 @@ prune_unused_types_walk_attribs (dw_die_ref die)
/* A reference to another DIE.
Make sure that it will get emitted.
If it was broken out into a comdat group, don't follow it. */
- if (dwarf_version < 4
+ if (! use_debug_types
|| a->dw_attr == DW_AT_specification
|| a->dw_attr_val.v.val_die_ref.die->die_id.die_type_node == NULL)
prune_unused_types_mark (a->dw_attr_val.v.val_die_ref.die, 1);
@@ -22518,7 +22528,7 @@ prune_unused_types_mark (dw_die_ref die, int dokids)
breaking out types into comdat sections, do this
for all type definitions. */
if (die->die_tag == DW_TAG_array_type
- || (dwarf_version >= 4
+ || (use_debug_types
&& is_type_die (die) && ! is_declaration_die (die)))
FOR_EACH_CHILD (die, c, prune_unused_types_mark (c, 1));
else
@@ -23487,11 +23497,11 @@ dwarf2out_finish (const char *filename)
/* Generate separate CUs for each of the include files we've seen.
They will go into limbo_die_list. */
- if (flag_eliminate_dwarf2_dups && dwarf_version < 4)
+ if (flag_eliminate_dwarf2_dups && ! use_debug_types)
break_out_includes (comp_unit_die ());
/* Generate separate COMDAT sections for type DIEs. */
- if (dwarf_version >= 4)
+ if (use_debug_types)
{
break_out_comdat_types (comp_unit_die ());
--
1.7.4