Hi!
The GNU DW_AT_GNU_macros and .debug_macro* extensions were added to DWARF5,
so we should emit those even in -gstrict-dwarf -gdwarf-5 mode.
Bootstrapped/regtested on x86_64-linux and i686-linux on top of the
dwarf2.{def,h} patch, ok for trunk?
2016-10-14 Jakub Jelinek
* dwarf2out.c (dwarf2out_define, dwarf2out_undef, output_macinfo_op,
optimize_macinfo_range, save_macinfo_strings): Replace
DW_MACRO_GNU_* constants with corresponding DW_MACRO_* constants.
(output_macinfo): Likewise. Emit .debug_macro* rather than
.debug_macinfo* even for -gstrict-dwarf -gdwarf-5.
(init_sections_and_labels): Use .debug_macro* labels rather than
.debug_macinfo* labels even for -gstrict-dwarf -gdwarf-5.
(dwarf2out_finish): Use DW_AT_macros instead of DW_AT_macro_info
or DW_AT_GNU_macros for -gdwarf-5.
--- gcc/dwarf2out.c.jj 2016-10-14 16:39:12.0 +0200
+++ gcc/dwarf2out.c 2016-10-14 17:59:32.304773877 +0200
@@ -25213,7 +25213,7 @@ dwarf2out_define (unsigned int lineno AT
{
macinfo_entry e;
/* Insert a dummy first entry to be able to optimize the whole
-predefined macro block using DW_MACRO_GNU_transparent_include. */
+predefined macro block using DW_MACRO_import. */
if (macinfo_table->is_empty () && lineno <= 1)
{
e.code = 0;
@@ -25240,7 +25240,7 @@ dwarf2out_undef (unsigned int lineno ATT
{
macinfo_entry e;
/* Insert a dummy first entry to be able to optimize the whole
-predefined macro block using DW_MACRO_GNU_transparent_include. */
+predefined macro block using DW_MACRO_import. */
if (macinfo_table->is_empty () && lineno <= 1)
{
e.code = 0;
@@ -25312,8 +25312,7 @@ output_macinfo_op (macinfo_entry *ref)
&& (debug_str_section->common.flags & SECTION_MERGE) != 0)
{
ref->code = ref->code == DW_MACINFO_define
- ? DW_MACRO_GNU_define_indirect
- : DW_MACRO_GNU_undef_indirect;
+ ? DW_MACRO_define_strp : DW_MACRO_undef_strp;
output_macinfo_op (ref);
return;
}
@@ -25324,16 +25323,16 @@ output_macinfo_op (macinfo_entry *ref)
(unsigned long) ref->lineno);
dw2_asm_output_nstring (ref->info, -1, "The macro");
break;
-case DW_MACRO_GNU_define_indirect:
-case DW_MACRO_GNU_undef_indirect:
+case DW_MACRO_define_strp:
+case DW_MACRO_undef_strp:
node = find_AT_string (ref->info);
gcc_assert (node
- && ((node->form == DW_FORM_strp)
- || (node->form == DW_FORM_GNU_str_index)));
+ && (node->form == DW_FORM_strp
+ || node->form == DW_FORM_GNU_str_index));
dw2_asm_output_data (1, ref->code,
- ref->code == DW_MACRO_GNU_define_indirect
- ? "Define macro indirect"
- : "Undefine macro indirect");
+ ref->code == DW_MACRO_define_strp
+ ? "Define macro strp"
+ : "Undefine macro strp");
dw2_asm_output_data_uleb128 (ref->lineno, "At line number %lu",
(unsigned long) ref->lineno);
if (node->form == DW_FORM_strp)
@@ -25344,8 +25343,8 @@ output_macinfo_op (macinfo_entry *ref)
dw2_asm_output_data_uleb128 (node->index, "The macro: \"%s\"",
ref->info);
break;
-case DW_MACRO_GNU_transparent_include:
- dw2_asm_output_data (1, ref->code, "Transparent include");
+case DW_MACRO_import:
+ dw2_asm_output_data (1, ref->code, "Import");
ASM_GENERATE_INTERNAL_LABEL (label,
DEBUG_MACRO_SECTION_LABEL, ref->lineno);
dw2_asm_output_offset (DWARF_OFFSET_SIZE, label, NULL, NULL);
@@ -25361,7 +25360,7 @@ output_macinfo_op (macinfo_entry *ref)
other compilation unit .debug_macinfo sections. IDX is the first
index of a define/undef, return the number of ops that should be
emitted in a comdat .debug_macinfo section and emit
- a DW_MACRO_GNU_transparent_include entry referencing it.
+ a DW_MACRO_import entry referencing it.
If the define/undef entry should be emitted normally, return 0. */
static unsigned
@@ -25447,10 +25446,10 @@ optimize_macinfo_range (unsigned int idx
for (i = 0; i < 16; i++)
sprintf (tail + i * 2, "%02x", checksum[i] & 0xff);
- /* Construct a macinfo_entry for DW_MACRO_GNU_transparent_include
+ /* Construct a macinfo_entry for DW_MACRO_import
in the empty vector entry before the first define/undef. */
inc = &(*macinfo_table)[idx - 1];
- inc->code = DW_MACRO_GNU_transparent_include;
+ inc->code = DW_MACRO_import;
inc->lineno = 0;
inc->info = ggc_strdup (grp_name);
if (!*macinfo_htab)
@@