Split DWARF files aren't processed by the linker, so DW_MACRO_import
offsets aren't relocated and the .debug_macro.dwo sections aren't
deduplicated and merged. There's no clear way for this to work for
split DWARF, so disable it.
gcc/ChangeLog:
PR debug/111409
* dwarf2out.cc (output_macinfo): Don't call optimize_macinfo_range if
dwarf_split_debug_info.
gcc/testsuite/ChangeLog:
PR debug/111409
* gcc.dg/pr111409.c: New test.
case DW_MACINFO_define:
case DW_MACINFO_undef:
if ((!dwarf_strict || dwarf_version >= 5)
+ && !dwarf_split_debug_info
&& HAVE_COMDAT_GROUP
&& vec_safe_length (files) != 1
&& i > 0
--- /dev/null
+/* { dg-do compile } */
+/* { dg-skip-if "split DWARF unsupported" { *-*-darwin* } } */
+/* { dg-options "-gsplit-dwarf -g3 -dA" } */
+/* { dg-final { scan-assembler-times {.section\s+.debug_macro} 1 } } */
+/* { dg-final { scan-assembler-not {.byte\s+0x7\s*#\s*Import} } } */
+
+#define foo 1