From 520c47e803fb8c94b864d4a1dd0f79153eae7835 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 31 Oct 2016 17:32:20 +0100 Subject: [PATCH] dwarf2out.c (dwarf2out_define, [...]): Replace DW_MACRO_GNU_* constants with corresponding DW_MACRO_* constants. * 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. From-SVN: r241705 --- gcc/ChangeLog | 14 ++++++++- gcc/dwarf2out.c | 76 +++++++++++++++++++++++++------------------------ 2 files changed, 52 insertions(+), 38 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f7adca25fe1..d462d731212 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2016-10-31 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. + 2016-10-31 Waldemar Brodkorb * config/microblaze/linux.h (UCLIBC_DYNAMIC_LINKER): Define. @@ -504,7 +516,7 @@ 2016-10-26 Jakub Jelinek - * gen-pass-instances.awk (adjust_linenos): INcrement pass_lines[p] + * gen-pass-instances.awk (adjust_linenos): Increment pass_lines[p] by increment rather than double it. (insert_remove_pass): Strip leading whitespace from args[3]. Don't emit a space before args[4]. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 78a29799564..615eca87152 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -25165,7 +25165,7 @@ dwarf2out_define (unsigned int lineno ATTRIBUTE_UNUSED, { 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; @@ -25192,7 +25192,7 @@ dwarf2out_undef (unsigned int lineno ATTRIBUTE_UNUSED, { 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; @@ -25264,8 +25264,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; } @@ -25276,16 +25275,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) @@ -25296,8 +25295,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); @@ -25313,7 +25312,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 @@ -25399,10 +25398,10 @@ optimize_macinfo_range (unsigned int idx, vec *files, 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) @@ -25414,7 +25413,7 @@ optimize_macinfo_range (unsigned int idx, vec *files, inc->code = 0; inc->info = NULL; /* If such an entry has been used before, just emit - a DW_MACRO_GNU_transparent_include op. */ + a DW_MACRO_import op. */ inc = *slot; output_macinfo_op (inc); /* And clear all macinfo_entry in the range to avoid emitting them @@ -25460,8 +25459,8 @@ save_macinfo_strings (void) && (debug_str_section->common.flags & SECTION_MERGE) != 0) set_indirect_string (find_AT_string (ref->info)); break; - case DW_MACRO_GNU_define_indirect: - case DW_MACRO_GNU_undef_indirect: + case DW_MACRO_define_strp: + case DW_MACRO_undef_strp: set_indirect_string (find_AT_string (ref->info)); break; default: @@ -25485,15 +25484,16 @@ output_macinfo (void) return; /* output_macinfo* uses these interchangeably. */ - gcc_assert ((int) DW_MACINFO_define == (int) DW_MACRO_GNU_define - && (int) DW_MACINFO_undef == (int) DW_MACRO_GNU_undef - && (int) DW_MACINFO_start_file == (int) DW_MACRO_GNU_start_file - && (int) DW_MACINFO_end_file == (int) DW_MACRO_GNU_end_file); + gcc_assert ((int) DW_MACINFO_define == (int) DW_MACRO_define + && (int) DW_MACINFO_undef == (int) DW_MACRO_undef + && (int) DW_MACINFO_start_file == (int) DW_MACRO_start_file + && (int) DW_MACINFO_end_file == (int) DW_MACRO_end_file); /* For .debug_macro emit the section header. */ - if (!dwarf_strict) + if (!dwarf_strict || dwarf_version >= 5) { - dw2_asm_output_data (2, 4, "DWARF macro version number"); + dw2_asm_output_data (2, dwarf_version >= 5 ? 5 : 4, + "DWARF macro version number"); if (DWARF_OFFSET_SIZE == 8) dw2_asm_output_data (1, 3, "Flags: 64-bit, lineptr present"); else @@ -25507,8 +25507,7 @@ output_macinfo (void) /* In the first loop, it emits the primary .debug_macinfo section and after each emitted op the macinfo_entry is cleared. If a longer range of define/undef ops can be optimized using - DW_MACRO_GNU_transparent_include, the - DW_MACRO_GNU_transparent_include op is emitted and kept in + DW_MACRO_import, the DW_MACRO_import op is emitted and kept in the vector before the first define/undef in the range and the whole range of define/undef ops is not emitted and kept. */ for (i = 0; macinfo_table->iterate (i, &ref); i++) @@ -25524,7 +25523,7 @@ output_macinfo (void) break; case DW_MACINFO_define: case DW_MACINFO_undef: - if (!dwarf_strict + if ((!dwarf_strict || dwarf_version >= 5) && HAVE_COMDAT_GROUP && vec_safe_length (files) != 1 && i > 0 @@ -25558,16 +25557,15 @@ output_macinfo (void) delete macinfo_htab; macinfo_htab = NULL; - /* If any DW_MACRO_GNU_transparent_include were used, on those - DW_MACRO_GNU_transparent_include entries terminate the - current chain and switch to a new comdat .debug_macinfo + /* If any DW_MACRO_import were used, on those DW_MACRO_import entries + terminate the current chain and switch to a new comdat .debug_macinfo section and emit the define/undef entries within it. */ for (i = 0; macinfo_table->iterate (i, &ref); i++) switch (ref->code) { case 0: continue; - case DW_MACRO_GNU_transparent_include: + case DW_MACRO_import: { char label[MAX_ARTIFICIAL_LABEL_BYTES]; tree comdat_key = get_identifier (ref->info); @@ -25583,7 +25581,8 @@ output_macinfo (void) ASM_OUTPUT_LABEL (asm_out_file, label); ref->code = 0; ref->info = NULL; - dw2_asm_output_data (2, 4, "DWARF macro version number"); + dw2_asm_output_data (2, dwarf_version >= 5 ? 5 : 4, + "DWARF macro version number"); if (DWARF_OFFSET_SIZE == 8) dw2_asm_output_data (1, 1, "Flags: 64-bit"); else @@ -25615,7 +25614,8 @@ init_sections_and_labels (void) debug_loc_section = get_section (DEBUG_LOC_SECTION, SECTION_DEBUG, NULL); debug_macinfo_section_name - = dwarf_strict ? DEBUG_MACINFO_SECTION : DEBUG_MACRO_SECTION; + = (dwarf_strict && dwarf_version < 5) + ? DEBUG_MACINFO_SECTION : DEBUG_MACRO_SECTION; debug_macinfo_section = get_section (debug_macinfo_section_name, SECTION_DEBUG, NULL); } @@ -25652,7 +25652,8 @@ init_sections_and_labels (void) debug_str_dwo_section = get_section (DEBUG_STR_DWO_SECTION, DEBUG_STR_DWO_SECTION_FLAGS, NULL); debug_macinfo_section_name - = dwarf_strict ? DEBUG_DWO_MACINFO_SECTION : DEBUG_DWO_MACRO_SECTION; + = (dwarf_strict && dwarf_version < 5) + ? DEBUG_DWO_MACINFO_SECTION : DEBUG_DWO_MACRO_SECTION; debug_macinfo_section = get_section (debug_macinfo_section_name, SECTION_DEBUG | SECTION_EXCLUDE, NULL); @@ -25683,7 +25684,7 @@ init_sections_and_labels (void) ASM_GENERATE_INTERNAL_LABEL (debug_addr_section_label, DEBUG_ADDR_SECTION_LABEL, 0); ASM_GENERATE_INTERNAL_LABEL (macinfo_section_label, - dwarf_strict + (dwarf_strict && dwarf_version < 5) ? DEBUG_MACINFO_SECTION_LABEL : DEBUG_MACRO_SECTION_LABEL, 0); ASM_GENERATE_INTERNAL_LABEL (loc_section_label, DEBUG_LOC_SECTION_LABEL, 0); @@ -27999,7 +28000,8 @@ dwarf2out_finish (const char *) if (have_macinfo) add_AT_macptr (comp_unit_die (), - dwarf_strict ? DW_AT_macro_info : DW_AT_GNU_macros, + dwarf_version >= 5 ? DW_AT_macros + : dwarf_strict ? DW_AT_macro_info : DW_AT_GNU_macros, macinfo_section_label); if (dwarf_split_debug_info) -- 2.30.2