debug/111409 - don't generate COMDAT macro sections for split DWARF

Message ID 28b5f064b4f94531489383fa6a9979c4e1484aef.1694673609.git.osandov@osandov.com
State Unresolved
Headers
Series debug/111409 - don't generate COMDAT macro sections for split DWARF |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Omar Sandoval Sept. 14, 2023, 6:41 a.m. UTC
  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.
---
 gcc/ChangeLog                   | 6 ++++++
 gcc/dwarf2out.cc                | 1 +
 gcc/testsuite/ChangeLog         | 5 +++++
 gcc/testsuite/gcc.dg/pr111409.c | 7 +++++++
 4 files changed, 19 insertions(+)
 create mode 100644 gcc/testsuite/gcc.dg/pr111409.c
  

Comments

Richard Biener Sept. 19, 2023, 12:56 p.m. UTC | #1
On Thu, Sep 14, 2023 at 8:42 AM Omar Sandoval <osandov@osandov.com> wrote:
>
> 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.

OK.

Thanks,
Richard.

> 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.
> ---
>  gcc/ChangeLog                   | 6 ++++++
>  gcc/dwarf2out.cc                | 1 +
>  gcc/testsuite/ChangeLog         | 5 +++++
>  gcc/testsuite/gcc.dg/pr111409.c | 7 +++++++
>  4 files changed, 19 insertions(+)
>  create mode 100644 gcc/testsuite/gcc.dg/pr111409.c
>
> diff --git a/gcc/ChangeLog b/gcc/ChangeLog
> index b69160b025d..2b0ff902f55 100644
> --- a/gcc/ChangeLog
> +++ b/gcc/ChangeLog
> @@ -1,3 +1,9 @@
> +2023-09-13  Omar Sandoval  <osandov@osandov.com>
> +
> +       PR debug/111409
> +       * dwarf2out.cc (output_macinfo): Don't call optimize_macinfo_range if
> +       dwarf_split_debug_info.
> +
>  2023-09-12  Juzhe-Zhong  <juzhe.zhong@rivai.ai>
>
>         PR target/111337
> diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
> index c4a935d5101..f60a0656d8f 100644
> --- a/gcc/dwarf2out.cc
> +++ b/gcc/dwarf2out.cc
> @@ -29247,6 +29247,7 @@ output_macinfo (const char *debug_line_label, bool early_lto_debug)
>         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
> diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
> index de0eadc31d7..3534e203a8a 100644
> --- a/gcc/testsuite/ChangeLog
> +++ b/gcc/testsuite/ChangeLog
> @@ -1,3 +1,8 @@
> +2023-09-13  Omar Sandoval  <osandov@osandov.com>
> +
> +       PR debug/111409
> +       * gcc.dg/pr111409.c: New test.
> +
>  2023-09-12  Juzhe-Zhong  <juzhe.zhong@rivai.ai>
>
>         * lib/target-supports.exp: Enable vect_int for RVV.
> diff --git a/gcc/testsuite/gcc.dg/pr111409.c b/gcc/testsuite/gcc.dg/pr111409.c
> new file mode 100644
> index 00000000000..1a79d81444e
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/pr111409.c
> @@ -0,0 +1,7 @@
> +/* { 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
> --
> 2.41.0
>
  
Omar Sandoval Sept. 19, 2023, 9:02 p.m. UTC | #2
On Tue, Sep 19, 2023 at 02:56:36PM +0200, Richard Biener wrote:
> On Thu, Sep 14, 2023 at 8:42 AM Omar Sandoval <osandov@osandov.com> wrote:
> >
> > 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.
> 
> OK.
> 
> Thanks,
> Richard.

Thank you! I don't have write access, how can I get this committed?

Omar
  
Richard Biener Sept. 20, 2023, 6:03 a.m. UTC | #3
On Tue, Sep 19, 2023 at 11:02 PM Omar Sandoval <osandov@osandov.com> wrote:
>
> On Tue, Sep 19, 2023 at 02:56:36PM +0200, Richard Biener wrote:
> > On Thu, Sep 14, 2023 at 8:42 AM Omar Sandoval <osandov@osandov.com> wrote:
> > >
> > > 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.
> >
> > OK.
> >
> > Thanks,
> > Richard.
>
> Thank you! I don't have write access, how can I get this committed?

I pushed it for you.

Richard.

> Omar
  

Patch

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b69160b025d..2b0ff902f55 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@ 
+2023-09-13  Omar Sandoval  <osandov@osandov.com>
+
+	PR debug/111409
+	* dwarf2out.cc (output_macinfo): Don't call optimize_macinfo_range if
+	dwarf_split_debug_info.
+
 2023-09-12  Juzhe-Zhong  <juzhe.zhong@rivai.ai>
 
 	PR target/111337
diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
index c4a935d5101..f60a0656d8f 100644
--- a/gcc/dwarf2out.cc
+++ b/gcc/dwarf2out.cc
@@ -29247,6 +29247,7 @@  output_macinfo (const char *debug_line_label, bool early_lto_debug)
 	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
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index de0eadc31d7..3534e203a8a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@ 
+2023-09-13  Omar Sandoval  <osandov@osandov.com>
+
+	PR debug/111409
+	* gcc.dg/pr111409.c: New test.
+
 2023-09-12  Juzhe-Zhong  <juzhe.zhong@rivai.ai>
 
 	* lib/target-supports.exp: Enable vect_int for RVV.
diff --git a/gcc/testsuite/gcc.dg/pr111409.c b/gcc/testsuite/gcc.dg/pr111409.c
new file mode 100644
index 00000000000..1a79d81444e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr111409.c
@@ -0,0 +1,7 @@ 
+/* { 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