@@ -29045,7 +29045,7 @@ output_macinfo_op (macinfo_entry *ref)
&& !DWARF2_INDIRECT_STRING_SUPPORT_MISSING_ON_TARGET
&& (debug_str_section->common.flags & SECTION_MERGE) != 0)
{
- if (dwarf_split_debug_info && dwarf_version >= 5)
+ if (dwarf_split_debug_info)
ref->code = ref->code == DW_MACINFO_define
? DW_MACRO_define_strx : DW_MACRO_undef_strx;
else
@@ -29097,12 +29097,20 @@ output_macinfo_op (macinfo_entry *ref)
HOST_WIDE_INT_PRINT_UNSIGNED,
ref->lineno);
if (node->form == DW_FORM_strp)
- dw2_asm_output_offset (dwarf_offset_size, node->label,
- debug_str_section, "The macro: \"%s\"",
- ref->info);
+ {
+ gcc_assert (ref->code == DW_MACRO_define_strp
+ || ref->code == DW_MACRO_undef_strp);
+ dw2_asm_output_offset (dwarf_offset_size, node->label,
+ debug_str_section, "The macro: \"%s\"",
+ ref->info);
+ }
else
- dw2_asm_output_data_uleb128 (node->index, "The macro: \"%s\"",
- ref->info);
+ {
+ gcc_assert (ref->code == DW_MACRO_define_strx
+ || ref->code == DW_MACRO_undef_strx);
+ dw2_asm_output_data_uleb128 (node->index, "The macro: \"%s\"",
+ ref->info);
+ }
break;
case DW_MACRO_import:
dw2_asm_output_data (1, ref->code, "Import");
new file mode 100644
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-skip-if "split DWARF unsupported" { hppa*-*-hpux* powerpc*-ibm-aix* *-*-darwin* } } */
+/* { dg-options "-gsplit-dwarf -g3 -dA -gdwarf-4" } */
+/* { dg-final { scan-assembler-times {\.section\t"?\.debug_macro} 1 } } */
+/* { dg-final { scan-assembler-not {\.byte\t0x5\t# Define macro strp} } } */
+/* { dg-final { scan-assembler {\.byte\t0xb\t# Define macro strx} } } */
+
+#define foo 1