Commit 520c47e8 by Jakub Jelinek Committed by Jakub Jelinek

dwarf2out.c (dwarf2out_define, [...]): Replace DW_MACRO_GNU_* constants with…

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
parent c667cdd7
2016-10-31 Jakub Jelinek <jakub@redhat.com>
* 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 <wbx@openadk.org> 2016-10-31 Waldemar Brodkorb <wbx@openadk.org>
* config/microblaze/linux.h (UCLIBC_DYNAMIC_LINKER): Define. * config/microblaze/linux.h (UCLIBC_DYNAMIC_LINKER): Define.
...@@ -504,7 +516,7 @@ ...@@ -504,7 +516,7 @@
2016-10-26 Jakub Jelinek <jakub@redhat.com> 2016-10-26 Jakub Jelinek <jakub@redhat.com>
* 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. by increment rather than double it.
(insert_remove_pass): Strip leading whitespace from args[3]. Don't (insert_remove_pass): Strip leading whitespace from args[3]. Don't
emit a space before args[4]. emit a space before args[4].
...@@ -25165,7 +25165,7 @@ dwarf2out_define (unsigned int lineno ATTRIBUTE_UNUSED, ...@@ -25165,7 +25165,7 @@ dwarf2out_define (unsigned int lineno ATTRIBUTE_UNUSED,
{ {
macinfo_entry e; macinfo_entry e;
/* Insert a dummy first entry to be able to optimize the whole /* 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) if (macinfo_table->is_empty () && lineno <= 1)
{ {
e.code = 0; e.code = 0;
...@@ -25192,7 +25192,7 @@ dwarf2out_undef (unsigned int lineno ATTRIBUTE_UNUSED, ...@@ -25192,7 +25192,7 @@ dwarf2out_undef (unsigned int lineno ATTRIBUTE_UNUSED,
{ {
macinfo_entry e; macinfo_entry e;
/* Insert a dummy first entry to be able to optimize the whole /* 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) if (macinfo_table->is_empty () && lineno <= 1)
{ {
e.code = 0; e.code = 0;
...@@ -25264,8 +25264,7 @@ output_macinfo_op (macinfo_entry *ref) ...@@ -25264,8 +25264,7 @@ output_macinfo_op (macinfo_entry *ref)
&& (debug_str_section->common.flags & SECTION_MERGE) != 0) && (debug_str_section->common.flags & SECTION_MERGE) != 0)
{ {
ref->code = ref->code == DW_MACINFO_define ref->code = ref->code == DW_MACINFO_define
? DW_MACRO_GNU_define_indirect ? DW_MACRO_define_strp : DW_MACRO_undef_strp;
: DW_MACRO_GNU_undef_indirect;
output_macinfo_op (ref); output_macinfo_op (ref);
return; return;
} }
...@@ -25276,16 +25275,16 @@ output_macinfo_op (macinfo_entry *ref) ...@@ -25276,16 +25275,16 @@ output_macinfo_op (macinfo_entry *ref)
(unsigned long) ref->lineno); (unsigned long) ref->lineno);
dw2_asm_output_nstring (ref->info, -1, "The macro"); dw2_asm_output_nstring (ref->info, -1, "The macro");
break; break;
case DW_MACRO_GNU_define_indirect: case DW_MACRO_define_strp:
case DW_MACRO_GNU_undef_indirect: case DW_MACRO_undef_strp:
node = find_AT_string (ref->info); node = find_AT_string (ref->info);
gcc_assert (node gcc_assert (node
&& ((node->form == DW_FORM_strp) && (node->form == DW_FORM_strp
|| (node->form == DW_FORM_GNU_str_index))); || node->form == DW_FORM_GNU_str_index));
dw2_asm_output_data (1, ref->code, dw2_asm_output_data (1, ref->code,
ref->code == DW_MACRO_GNU_define_indirect ref->code == DW_MACRO_define_strp
? "Define macro indirect" ? "Define macro strp"
: "Undefine macro indirect"); : "Undefine macro strp");
dw2_asm_output_data_uleb128 (ref->lineno, "At line number %lu", dw2_asm_output_data_uleb128 (ref->lineno, "At line number %lu",
(unsigned long) ref->lineno); (unsigned long) ref->lineno);
if (node->form == DW_FORM_strp) if (node->form == DW_FORM_strp)
...@@ -25296,8 +25295,8 @@ output_macinfo_op (macinfo_entry *ref) ...@@ -25296,8 +25295,8 @@ output_macinfo_op (macinfo_entry *ref)
dw2_asm_output_data_uleb128 (node->index, "The macro: \"%s\"", dw2_asm_output_data_uleb128 (node->index, "The macro: \"%s\"",
ref->info); ref->info);
break; break;
case DW_MACRO_GNU_transparent_include: case DW_MACRO_import:
dw2_asm_output_data (1, ref->code, "Transparent include"); dw2_asm_output_data (1, ref->code, "Import");
ASM_GENERATE_INTERNAL_LABEL (label, ASM_GENERATE_INTERNAL_LABEL (label,
DEBUG_MACRO_SECTION_LABEL, ref->lineno); DEBUG_MACRO_SECTION_LABEL, ref->lineno);
dw2_asm_output_offset (DWARF_OFFSET_SIZE, label, NULL, NULL); dw2_asm_output_offset (DWARF_OFFSET_SIZE, label, NULL, NULL);
...@@ -25313,7 +25312,7 @@ output_macinfo_op (macinfo_entry *ref) ...@@ -25313,7 +25312,7 @@ output_macinfo_op (macinfo_entry *ref)
other compilation unit .debug_macinfo sections. IDX is the first other compilation unit .debug_macinfo sections. IDX is the first
index of a define/undef, return the number of ops that should be index of a define/undef, return the number of ops that should be
emitted in a comdat .debug_macinfo section and emit 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. */ If the define/undef entry should be emitted normally, return 0. */
static unsigned static unsigned
...@@ -25399,10 +25398,10 @@ optimize_macinfo_range (unsigned int idx, vec<macinfo_entry, va_gc> *files, ...@@ -25399,10 +25398,10 @@ optimize_macinfo_range (unsigned int idx, vec<macinfo_entry, va_gc> *files,
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
sprintf (tail + i * 2, "%02x", checksum[i] & 0xff); 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. */ in the empty vector entry before the first define/undef. */
inc = &(*macinfo_table)[idx - 1]; inc = &(*macinfo_table)[idx - 1];
inc->code = DW_MACRO_GNU_transparent_include; inc->code = DW_MACRO_import;
inc->lineno = 0; inc->lineno = 0;
inc->info = ggc_strdup (grp_name); inc->info = ggc_strdup (grp_name);
if (!*macinfo_htab) if (!*macinfo_htab)
...@@ -25414,7 +25413,7 @@ optimize_macinfo_range (unsigned int idx, vec<macinfo_entry, va_gc> *files, ...@@ -25414,7 +25413,7 @@ optimize_macinfo_range (unsigned int idx, vec<macinfo_entry, va_gc> *files,
inc->code = 0; inc->code = 0;
inc->info = NULL; inc->info = NULL;
/* If such an entry has been used before, just emit /* If such an entry has been used before, just emit
a DW_MACRO_GNU_transparent_include op. */ a DW_MACRO_import op. */
inc = *slot; inc = *slot;
output_macinfo_op (inc); output_macinfo_op (inc);
/* And clear all macinfo_entry in the range to avoid emitting them /* And clear all macinfo_entry in the range to avoid emitting them
...@@ -25460,8 +25459,8 @@ save_macinfo_strings (void) ...@@ -25460,8 +25459,8 @@ save_macinfo_strings (void)
&& (debug_str_section->common.flags & SECTION_MERGE) != 0) && (debug_str_section->common.flags & SECTION_MERGE) != 0)
set_indirect_string (find_AT_string (ref->info)); set_indirect_string (find_AT_string (ref->info));
break; break;
case DW_MACRO_GNU_define_indirect: case DW_MACRO_define_strp:
case DW_MACRO_GNU_undef_indirect: case DW_MACRO_undef_strp:
set_indirect_string (find_AT_string (ref->info)); set_indirect_string (find_AT_string (ref->info));
break; break;
default: default:
...@@ -25485,15 +25484,16 @@ output_macinfo (void) ...@@ -25485,15 +25484,16 @@ output_macinfo (void)
return; return;
/* output_macinfo* uses these interchangeably. */ /* output_macinfo* uses these interchangeably. */
gcc_assert ((int) DW_MACINFO_define == (int) DW_MACRO_GNU_define gcc_assert ((int) DW_MACINFO_define == (int) DW_MACRO_define
&& (int) DW_MACINFO_undef == (int) DW_MACRO_GNU_undef && (int) DW_MACINFO_undef == (int) DW_MACRO_undef
&& (int) DW_MACINFO_start_file == (int) DW_MACRO_GNU_start_file && (int) DW_MACINFO_start_file == (int) DW_MACRO_start_file
&& (int) DW_MACINFO_end_file == (int) DW_MACRO_GNU_end_file); && (int) DW_MACINFO_end_file == (int) DW_MACRO_end_file);
/* For .debug_macro emit the section header. */ /* 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) if (DWARF_OFFSET_SIZE == 8)
dw2_asm_output_data (1, 3, "Flags: 64-bit, lineptr present"); dw2_asm_output_data (1, 3, "Flags: 64-bit, lineptr present");
else else
...@@ -25507,8 +25507,7 @@ output_macinfo (void) ...@@ -25507,8 +25507,7 @@ output_macinfo (void)
/* In the first loop, it emits the primary .debug_macinfo section /* In the first loop, it emits the primary .debug_macinfo section
and after each emitted op the macinfo_entry is cleared. and after each emitted op the macinfo_entry is cleared.
If a longer range of define/undef ops can be optimized using If a longer range of define/undef ops can be optimized using
DW_MACRO_GNU_transparent_include, the DW_MACRO_import, the DW_MACRO_import op is emitted and kept in
DW_MACRO_GNU_transparent_include op is emitted and kept in
the vector before the first define/undef in the range and the the vector before the first define/undef in the range and the
whole range of define/undef ops is not emitted and kept. */ whole range of define/undef ops is not emitted and kept. */
for (i = 0; macinfo_table->iterate (i, &ref); i++) for (i = 0; macinfo_table->iterate (i, &ref); i++)
...@@ -25524,7 +25523,7 @@ output_macinfo (void) ...@@ -25524,7 +25523,7 @@ output_macinfo (void)
break; break;
case DW_MACINFO_define: case DW_MACINFO_define:
case DW_MACINFO_undef: case DW_MACINFO_undef:
if (!dwarf_strict if ((!dwarf_strict || dwarf_version >= 5)
&& HAVE_COMDAT_GROUP && HAVE_COMDAT_GROUP
&& vec_safe_length (files) != 1 && vec_safe_length (files) != 1
&& i > 0 && i > 0
...@@ -25558,16 +25557,15 @@ output_macinfo (void) ...@@ -25558,16 +25557,15 @@ output_macinfo (void)
delete macinfo_htab; delete macinfo_htab;
macinfo_htab = NULL; macinfo_htab = NULL;
/* If any DW_MACRO_GNU_transparent_include were used, on those /* If any DW_MACRO_import were used, on those DW_MACRO_import entries
DW_MACRO_GNU_transparent_include entries terminate the terminate the current chain and switch to a new comdat .debug_macinfo
current chain and switch to a new comdat .debug_macinfo
section and emit the define/undef entries within it. */ section and emit the define/undef entries within it. */
for (i = 0; macinfo_table->iterate (i, &ref); i++) for (i = 0; macinfo_table->iterate (i, &ref); i++)
switch (ref->code) switch (ref->code)
{ {
case 0: case 0:
continue; continue;
case DW_MACRO_GNU_transparent_include: case DW_MACRO_import:
{ {
char label[MAX_ARTIFICIAL_LABEL_BYTES]; char label[MAX_ARTIFICIAL_LABEL_BYTES];
tree comdat_key = get_identifier (ref->info); tree comdat_key = get_identifier (ref->info);
...@@ -25583,7 +25581,8 @@ output_macinfo (void) ...@@ -25583,7 +25581,8 @@ output_macinfo (void)
ASM_OUTPUT_LABEL (asm_out_file, label); ASM_OUTPUT_LABEL (asm_out_file, label);
ref->code = 0; ref->code = 0;
ref->info = NULL; 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) if (DWARF_OFFSET_SIZE == 8)
dw2_asm_output_data (1, 1, "Flags: 64-bit"); dw2_asm_output_data (1, 1, "Flags: 64-bit");
else else
...@@ -25615,7 +25614,8 @@ init_sections_and_labels (void) ...@@ -25615,7 +25614,8 @@ init_sections_and_labels (void)
debug_loc_section = get_section (DEBUG_LOC_SECTION, debug_loc_section = get_section (DEBUG_LOC_SECTION,
SECTION_DEBUG, NULL); SECTION_DEBUG, NULL);
debug_macinfo_section_name 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, debug_macinfo_section = get_section (debug_macinfo_section_name,
SECTION_DEBUG, NULL); SECTION_DEBUG, NULL);
} }
...@@ -25652,7 +25652,8 @@ init_sections_and_labels (void) ...@@ -25652,7 +25652,8 @@ init_sections_and_labels (void)
debug_str_dwo_section = get_section (DEBUG_STR_DWO_SECTION, debug_str_dwo_section = get_section (DEBUG_STR_DWO_SECTION,
DEBUG_STR_DWO_SECTION_FLAGS, NULL); DEBUG_STR_DWO_SECTION_FLAGS, NULL);
debug_macinfo_section_name 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, debug_macinfo_section = get_section (debug_macinfo_section_name,
SECTION_DEBUG | SECTION_EXCLUDE, SECTION_DEBUG | SECTION_EXCLUDE,
NULL); NULL);
...@@ -25683,7 +25684,7 @@ init_sections_and_labels (void) ...@@ -25683,7 +25684,7 @@ init_sections_and_labels (void)
ASM_GENERATE_INTERNAL_LABEL (debug_addr_section_label, ASM_GENERATE_INTERNAL_LABEL (debug_addr_section_label,
DEBUG_ADDR_SECTION_LABEL, 0); DEBUG_ADDR_SECTION_LABEL, 0);
ASM_GENERATE_INTERNAL_LABEL (macinfo_section_label, ASM_GENERATE_INTERNAL_LABEL (macinfo_section_label,
dwarf_strict (dwarf_strict && dwarf_version < 5)
? DEBUG_MACINFO_SECTION_LABEL ? DEBUG_MACINFO_SECTION_LABEL
: DEBUG_MACRO_SECTION_LABEL, 0); : DEBUG_MACRO_SECTION_LABEL, 0);
ASM_GENERATE_INTERNAL_LABEL (loc_section_label, DEBUG_LOC_SECTION_LABEL, 0); ASM_GENERATE_INTERNAL_LABEL (loc_section_label, DEBUG_LOC_SECTION_LABEL, 0);
...@@ -27999,7 +28000,8 @@ dwarf2out_finish (const char *) ...@@ -27999,7 +28000,8 @@ dwarf2out_finish (const char *)
if (have_macinfo) if (have_macinfo)
add_AT_macptr (comp_unit_die (), 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); macinfo_section_label);
if (dwarf_split_debug_info) if (dwarf_split_debug_info)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment