public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/115066] New: [debug, gsplit-dwarf, gdwarf-4, g3] DW_MACRO_define_strp used for debug_str_offsets index
@ 2024-05-13  8:40 vries at gcc dot gnu.org
  2024-05-13  8:42 ` [Bug debug/115066] " vries at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: vries at gcc dot gnu.org @ 2024-05-13  8:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115066

            Bug ID: 115066
           Summary: [debug, gsplit-dwarf, gdwarf-4, g3]
                    DW_MACRO_define_strp used for debug_str_offsets index
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

Consider a hello world, compiled with split dwarf and dwarf version 4, and -g3
for macro info:
...
$ gcc -gdwarf-4 -gsplit-dwarf /data/vries/hello.c -g3 -save-temps -dA
...

In section .debug_macro.dwo, we have:
...
.Ldebug_macro0:
        .value  0x4     # DWARF macro version number
        .byte   0x2     # Flags: 32-bit, lineptr present
        .long   .Lskeleton_debug_line0
        .byte   0x3     # Start new file
        .uleb128 0      # Included from line number 0
        .uleb128 0x1    # file /data/vries/hello.c
        .byte   0x5     # Define macro strp
        .uleb128 0      # At line number 0
        .uleb128 0x1d0  # The macro: "__STDC__ 1"
...

So, given that we use a DW_MACRO_define_strp, we'd expect 0x1d0 to be an offset
into a .debug_str section.

However, in .debug_str.dwo we find:
...
  0x000001d0 455f584f 50454e32 4b385853 49005345 E_XOPEN2K8XSI.SE
...

In fact, 0x1d0 is an index into the string offset table in
.debug_str_offsets.dwo:
...
        .long   0x34f0  # indexed string 0x1d0: __STDC__ 1
...

So, it looks like DW_MACRO_define_strx should have been used instead.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug debug/115066] [debug, gsplit-dwarf, gdwarf-4, g3] DW_MACRO_define_strp used for debug_str_offsets index
  2024-05-13  8:40 [Bug debug/115066] New: [debug, gsplit-dwarf, gdwarf-4, g3] DW_MACRO_define_strp used for debug_str_offsets index vries at gcc dot gnu.org
@ 2024-05-13  8:42 ` vries at gcc dot gnu.org
  2024-05-13  9:12 ` vries at gcc dot gnu.org
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: vries at gcc dot gnu.org @ 2024-05-13  8:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115066

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Looking at the source code, I wonder if this would fix it:
...
diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
index eedb13bb069..045858bf638 100644
--- a/gcc/dwarf2out.cc
+++ b/gcc/dwarf2out.cc
@@ -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 && (!dwarf_strict || dwarf_version >= 5))
            ref->code = ref->code == DW_MACINFO_define
                        ? DW_MACRO_define_strx : DW_MACRO_undef_strx;
          else
...

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug debug/115066] [debug, gsplit-dwarf, gdwarf-4, g3] DW_MACRO_define_strp used for debug_str_offsets index
  2024-05-13  8:40 [Bug debug/115066] New: [debug, gsplit-dwarf, gdwarf-4, g3] DW_MACRO_define_strp used for debug_str_offsets index vries at gcc dot gnu.org
  2024-05-13  8:42 ` [Bug debug/115066] " vries at gcc dot gnu.org
@ 2024-05-13  9:12 ` vries at gcc dot gnu.org
  2024-05-13 10:27 ` rguenth at gcc dot gnu.org
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: vries at gcc dot gnu.org @ 2024-05-13  9:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115066

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #1)
> Looking at the source code, I wonder if this would fix it:
> ...
> diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
> index eedb13bb069..045858bf638 100644
> --- a/gcc/dwarf2out.cc
> +++ b/gcc/dwarf2out.cc
> @@ -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 && (!dwarf_strict || dwarf_version >= 5))
>  	    ref->code = ref->code == DW_MACINFO_define
>  			? DW_MACRO_define_strx : DW_MACRO_undef_strx;
>  	  else
> ...

With that change I get:
...
.Ldebug_macro0:
        .value  0x4     # DWARF macro version number
        .byte   0x2     # Flags: 32-bit, lineptr present
        .long   .Lskeleton_debug_line0
        .byte   0x3     # Start new file
        .uleb128 0      # Included from line number 0
        .uleb128 0x1    # file /data/vries/hello.c
        .byte   0xb     # Define macro strx
        .uleb128 0      # At line number 0
        .uleb128 0x17b  # The macro: "__STDC__ 1"
...

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug debug/115066] [debug, gsplit-dwarf, gdwarf-4, g3] DW_MACRO_define_strp used for debug_str_offsets index
  2024-05-13  8:40 [Bug debug/115066] New: [debug, gsplit-dwarf, gdwarf-4, g3] DW_MACRO_define_strp used for debug_str_offsets index vries at gcc dot gnu.org
  2024-05-13  8:42 ` [Bug debug/115066] " vries at gcc dot gnu.org
  2024-05-13  9:12 ` vries at gcc dot gnu.org
@ 2024-05-13 10:27 ` rguenth at gcc dot gnu.org
  2024-05-13 10:29 ` vries at gcc dot gnu.org
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-05-13 10:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115066

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-debug

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
And with -gstrict-dwarf -gdwarf-4?

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug debug/115066] [debug, gsplit-dwarf, gdwarf-4, g3] DW_MACRO_define_strp used for debug_str_offsets index
  2024-05-13  8:40 [Bug debug/115066] New: [debug, gsplit-dwarf, gdwarf-4, g3] DW_MACRO_define_strp used for debug_str_offsets index vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-05-13 10:27 ` rguenth at gcc dot gnu.org
@ 2024-05-13 10:29 ` vries at gcc dot gnu.org
  2024-05-13 10:33 ` jakub at gcc dot gnu.org
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: vries at gcc dot gnu.org @ 2024-05-13 10:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115066

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #3)
> And with -gstrict-dwarf -gdwarf-4?

With:
...
$ gcc.sh -gdwarf-4 -gsplit-dwarf /data/vries/hello.c -g3 -gstrict-dwarf
...
we get:
...
        .section        .debug_macinfo.dwo,"e",@progbits
.Ldebug_macinfo0:
        .byte   0x3     # Start new file
        .uleb128 0      # Included from line number 0
        .uleb128 0x1    # file /data/vries/hello.c
        .byte   0x1     # Define macro
        .uleb128 0      # At line number 0
        .ascii "__STDC__ 1\0"   # The macro
...

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug debug/115066] [debug, gsplit-dwarf, gdwarf-4, g3] DW_MACRO_define_strp used for debug_str_offsets index
  2024-05-13  8:40 [Bug debug/115066] New: [debug, gsplit-dwarf, gdwarf-4, g3] DW_MACRO_define_strp used for debug_str_offsets index vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-05-13 10:29 ` vries at gcc dot gnu.org
@ 2024-05-13 10:33 ` jakub at gcc dot gnu.org
  2024-05-13 11:11 ` vries at gcc dot gnu.org
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-05-13 10:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115066

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #1)
> Looking at the source code, I wonder if this would fix it:
> ...
> diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
> index eedb13bb069..045858bf638 100644
> --- a/gcc/dwarf2out.cc
> +++ b/gcc/dwarf2out.cc
> @@ -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 && (!dwarf_strict || dwarf_version >= 5))
>  	    ref->code = ref->code == DW_MACINFO_define
>  			? DW_MACRO_define_strx : DW_MACRO_undef_strx;
>  	  else
> ...

Just make it if (dwarf_split_debug_info) then?
I mean, this whole code is guarded with
      if ((!dwarf_strict || dwarf_version >= 5)
          && ...)

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug debug/115066] [debug, gsplit-dwarf, gdwarf-4, g3] DW_MACRO_define_strp used for debug_str_offsets index
  2024-05-13  8:40 [Bug debug/115066] New: [debug, gsplit-dwarf, gdwarf-4, g3] DW_MACRO_define_strp used for debug_str_offsets index vries at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-05-13 10:33 ` jakub at gcc dot gnu.org
@ 2024-05-13 11:11 ` vries at gcc dot gnu.org
  2024-05-14 11:35 ` vries at gcc dot gnu.org
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: vries at gcc dot gnu.org @ 2024-05-13 11:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115066

--- Comment #6 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #5)
> Just make it if (dwarf_split_debug_info) then?

That works as well indeed:
...
diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
index eedb13bb069..70b7f5f42cd 100644
--- a/gcc/dwarf2out.cc
+++ b/gcc/dwarf2out.cc
@@ -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");
...

I've also added asserts detecting this PR.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug debug/115066] [debug, gsplit-dwarf, gdwarf-4, g3] DW_MACRO_define_strp used for debug_str_offsets index
  2024-05-13  8:40 [Bug debug/115066] New: [debug, gsplit-dwarf, gdwarf-4, g3] DW_MACRO_define_strp used for debug_str_offsets index vries at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2024-05-13 11:11 ` vries at gcc dot gnu.org
@ 2024-05-14 11:35 ` vries at gcc dot gnu.org
  2024-05-14 12:00 ` cvs-commit at gcc dot gnu.org
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: vries at gcc dot gnu.org @ 2024-05-14 11:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115066

--- Comment #7 from Tom de Vries <vries at gcc dot gnu.org> ---
Submitted here ( https://gcc.gnu.org/pipermail/gcc-patches/2024-May/651586.html
).

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug debug/115066] [debug, gsplit-dwarf, gdwarf-4, g3] DW_MACRO_define_strp used for debug_str_offsets index
  2024-05-13  8:40 [Bug debug/115066] New: [debug, gsplit-dwarf, gdwarf-4, g3] DW_MACRO_define_strp used for debug_str_offsets index vries at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2024-05-14 11:35 ` vries at gcc dot gnu.org
@ 2024-05-14 12:00 ` cvs-commit at gcc dot gnu.org
  2024-05-14 12:04 ` vries at gcc dot gnu.org
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-14 12:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115066

--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@gcc.gnu.org>:

https://gcc.gnu.org/g:b7003b4cc5e263343f047fe64ed1ae12f561b2d1

commit r15-483-gb7003b4cc5e263343f047fe64ed1ae12f561b2d1
Author: Tom de Vries <tdevries@suse.de>
Date:   Mon May 13 18:10:15 2024 +0200

    [debug] Fix dwarf v4 .debug_macro.dwo

    Consider a hello world, compiled with -gsplit-dwarf and dwarf version 4,
and
    -g3:
    ...
    $ gcc -gdwarf-4 -gsplit-dwarf /data/vries/hello.c -g3 -save-temps -dA
    ...

    In section .debug_macro.dwo, we have:
    ...
    .Ldebug_macro0:
            .value  0x4     # DWARF macro version number
            .byte   0x2     # Flags: 32-bit, lineptr present
            .long   .Lskeleton_debug_line0
            .byte   0x3     # Start new file
            .uleb128 0      # Included from line number 0
            .uleb128 0x1    # file /data/vries/hello.c
            .byte   0x5     # Define macro strp
            .uleb128 0      # At line number 0
            .uleb128 0x1d0  # The macro: "__STDC__ 1"
    ...

    Given that we use a DW_MACRO_define_strp, we'd expect 0x1d0 to be an
    offset into a .debug_str.dwo section.

    But in fact, 0x1d0 is an index into the string offset table in
    section .debug_str_offsets.dwo:
    ...
            .long   0x34f0  # indexed string 0x1d0: __STDC__ 1
    ...

    Add asserts that catch this inconsistency, and fix this by using
    DW_MACRO_define_strx instead.

    Tested on x86_64.

    gcc/ChangeLog:

    2024-05-14  Tom de Vries  <tdevries@suse.de>

            PR debug/115066
            * dwarf2out.cc (output_macinfo_op): Fix DW_MACRO_define_strx/strp
            choice for v4 .debug_macro.dwo.  Add asserts to check that choice.

    gcc/testsuite/ChangeLog:

    2024-05-14  Tom de Vries  <tdevries@suse.de>

            PR debug/115066
            * gcc.dg/pr115066.c: New test.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug debug/115066] [debug, gsplit-dwarf, gdwarf-4, g3] DW_MACRO_define_strp used for debug_str_offsets index
  2024-05-13  8:40 [Bug debug/115066] New: [debug, gsplit-dwarf, gdwarf-4, g3] DW_MACRO_define_strp used for debug_str_offsets index vries at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2024-05-14 12:00 ` cvs-commit at gcc dot gnu.org
@ 2024-05-14 12:04 ` vries at gcc dot gnu.org
  2024-05-16  8:35 ` ro at gcc dot gnu.org
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: vries at gcc dot gnu.org @ 2024-05-14 12:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115066

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |15.0
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #9 from Tom de Vries <vries at gcc dot gnu.org> ---
Fixed.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug debug/115066] [debug, gsplit-dwarf, gdwarf-4, g3] DW_MACRO_define_strp used for debug_str_offsets index
  2024-05-13  8:40 [Bug debug/115066] New: [debug, gsplit-dwarf, gdwarf-4, g3] DW_MACRO_define_strp used for debug_str_offsets index vries at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2024-05-14 12:04 ` vries at gcc dot gnu.org
@ 2024-05-16  8:35 ` ro at gcc dot gnu.org
  2024-05-16  9:06 ` vries at gcc dot gnu.org
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: ro at gcc dot gnu.org @ 2024-05-16  8:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115066

Rainer Orth <ro at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2024-05-16
                 CC|                            |ro at gcc dot gnu.org
         Resolution|FIXED                       |---
             Status|RESOLVED                    |REOPENED

--- Comment #10 from Rainer Orth <ro at gcc dot gnu.org> ---
The new test currently FAILs on Solaris/SPARC with the native as:

FAIL: gcc.dg/pr115066.c scan-assembler \\\\.byte\\\\t0xb\\\\t# Define macro
strx

The relevant snippet of pr115066.s is

        .section        ".debug_macro.dwo",#exclude,#progbits
.LLdebug_macro0:
        .uahalf 0x4     ! DWARF macro version number
        .byte   0x2     ! Flags: 32-bit, lineptr present
        .uaword .LLskeleton_debug_line0
        .byte   0x1     ! Define macro

while when using gas, I have

        .section        .debug_macro.dwo,"e",@progbits
.LLdebug_macro0: 
        .uahalf 0x4     ! DWARF macro version number
        .byte   0x2     ! Flags: 32-bit, lineptr present
        .uaword .LLskeleton_debug_line0
        .byte   0xb     ! Define macro strx

AFAICS from dwarf2out.cc (output_macinfo_op), the requirements for using
DW_MACRO_define_strx are (among others)
!DWARF2_INDIRECT_STRING_SUPPORT_MISSING_ON_TARGET && SECTION_MERGE.

However, with the native assembler, SHF_MERGE doesn't work (as emits something
ld cannot link).

I wonder how best to handle this: just skip the test on sparc*-sun-solaris2* &&
!gas?  Theoretically, there could be other targets with similar issues.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug debug/115066] [debug, gsplit-dwarf, gdwarf-4, g3] DW_MACRO_define_strp used for debug_str_offsets index
  2024-05-13  8:40 [Bug debug/115066] New: [debug, gsplit-dwarf, gdwarf-4, g3] DW_MACRO_define_strp used for debug_str_offsets index vries at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2024-05-16  8:35 ` ro at gcc dot gnu.org
@ 2024-05-16  9:06 ` vries at gcc dot gnu.org
  2024-05-16  9:22 ` ro at CeBiTec dot Uni-Bielefeld.DE
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: vries at gcc dot gnu.org @ 2024-05-16  9:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115066

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|REOPENED                    |RESOLVED

--- Comment #11 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Rainer Orth from comment #10)
> The new test currently FAILs on Solaris/SPARC with the native as:
> 
> FAIL: gcc.dg/pr115066.c scan-assembler \\\\.byte\\\\t0xb\\\\t# Define macro
> strx
> 
> The relevant snippet of pr115066.s is
> 
>         .section        ".debug_macro.dwo",#exclude,#progbits
> .LLdebug_macro0:
>         .uahalf 0x4     ! DWARF macro version number
>         .byte   0x2     ! Flags: 32-bit, lineptr present
>         .uaword .LLskeleton_debug_line0
>         .byte   0x1     ! Define macro
> 
> while when using gas, I have
> 
>         .section        .debug_macro.dwo,"e",@progbits
> .LLdebug_macro0: 
>         .uahalf 0x4     ! DWARF macro version number
>         .byte   0x2     ! Flags: 32-bit, lineptr present
>         .uaword .LLskeleton_debug_line0
>         .byte   0xb     ! Define macro strx
> 
> AFAICS from dwarf2out.cc (output_macinfo_op), the requirements for using
> DW_MACRO_define_strx are (among others)
> !DWARF2_INDIRECT_STRING_SUPPORT_MISSING_ON_TARGET && SECTION_MERGE.
> 
> However, with the native assembler, SHF_MERGE doesn't work (as emits
> something
> ld cannot link).
> 
> I wonder how best to handle this: just skip the test on sparc*-sun-solaris2*
> && !gas?  Theoretically, there could be other targets with similar issues.

This looks like test-case issue, so re-closing the PR.

How about:
...
-/* { dg-final { scan-assembler {\.byte\t0xb\t[^\n\r]* Define macro strx} } }
*/
+/* { dg-final { scan-assembler {\.byte\t0xb\t[^\n\r]* Define macro
strx|\.byte\t0x1\t[^\n\r]* Define macro}
...
?

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug debug/115066] [debug, gsplit-dwarf, gdwarf-4, g3] DW_MACRO_define_strp used for debug_str_offsets index
  2024-05-13  8:40 [Bug debug/115066] New: [debug, gsplit-dwarf, gdwarf-4, g3] DW_MACRO_define_strp used for debug_str_offsets index vries at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2024-05-16  9:06 ` vries at gcc dot gnu.org
@ 2024-05-16  9:22 ` ro at CeBiTec dot Uni-Bielefeld.DE
  2024-05-22  8:06 ` cvs-commit at gcc dot gnu.org
  2024-05-27 14:02 ` clyon at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: ro at CeBiTec dot Uni-Bielefeld.DE @ 2024-05-16  9:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115066

--- Comment #12 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> ---
> --- Comment #11 from Tom de Vries <vries at gcc dot gnu.org> ---
> (In reply to Rainer Orth from comment #10)
[...]
>> I wonder how best to handle this: just skip the test on sparc*-sun-solaris2*
>> && !gas?  Theoretically, there could be other targets with similar issues.
>
> This looks like test-case issue, so re-closing the PR.

True, but it's often way simpler to discuss testcase issues in the
original PR rather than open new PRs for every single issue with a
testcase (and there's already been the comment character one here).

> How about:
> ...
> -/* { dg-final { scan-assembler {\.byte\t0xb\t[^\n\r]* Define macro strx} } }
> */
> +/* { dg-final { scan-assembler {\.byte\t0xb\t[^\n\r]* Define macro
> strx|\.byte\t0x1\t[^\n\r]* Define macro}
> ...
> ?

Seems like an option, too (and would work on other affected targets
should they appear).  Tested on sparc-sun-solaris2.11 with as and gas.

Btw., I wonder which of the targets currently skipped with "split DWARF
unsupported" are instances of this problem, too: Solaris doesn't support
-gsplit-dwarf, still the test PASSes on Solaris/SPARC with gas and
Solaris/x86 with either assembler.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug debug/115066] [debug, gsplit-dwarf, gdwarf-4, g3] DW_MACRO_define_strp used for debug_str_offsets index
  2024-05-13  8:40 [Bug debug/115066] New: [debug, gsplit-dwarf, gdwarf-4, g3] DW_MACRO_define_strp used for debug_str_offsets index vries at gcc dot gnu.org
                   ` (11 preceding siblings ...)
  2024-05-16  9:22 ` ro at CeBiTec dot Uni-Bielefeld.DE
@ 2024-05-22  8:06 ` cvs-commit at gcc dot gnu.org
  2024-05-27 14:02 ` clyon at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-22  8:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115066

--- Comment #13 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Rainer Orth <ro@gcc.gnu.org>:

https://gcc.gnu.org/g:6c97934fde7caf483ffc5079eb8ca4af04354a2c

commit r15-767-g6c97934fde7caf483ffc5079eb8ca4af04354a2c
Author: Tom de Vries <tdevries@suse.de>
Date:   Wed May 22 10:06:10 2024 +0200

    testsuite: Allow for non-SECTION_MERGE systems in gcc.dg/pr115066.c
[PR115066]

    gcc.dg/pr115066.c currently FAILs on Solaris/SPARC with the native as:

    FAIL: gcc.dg/pr115066.c scan-assembler \\\\.byte\\\\t0xb\\\\t# Define macro
strx

    Instead of the expected

            .byte   0xb     ! Define macro strx

    the assembler output contains

            .byte   0x1     ! Define macro

    Apparently this happens because the Solaris as/ld combo doesn't support
    SHF_MERGE.

    While I initially meant to just skip the test on sparc*-*-solaris2* &&
!gas,
    Tom suggested to allow for both forms instead, which is what his patch
    does.

    Tested on sparc-sun-solaris2.11 and i386-pc-solaris2.11 (as and gas
    each) and x86_64-pc-linux-gnu.

    2024-05-21  Tom de Vries  <tdevries@suse.de>

            gcc/testsuite:
            PR debug/115066
            * gcc.dg/pr115066.c (scan-assembler): Allow for alternative form
            of Define macro.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug debug/115066] [debug, gsplit-dwarf, gdwarf-4, g3] DW_MACRO_define_strp used for debug_str_offsets index
  2024-05-13  8:40 [Bug debug/115066] New: [debug, gsplit-dwarf, gdwarf-4, g3] DW_MACRO_define_strp used for debug_str_offsets index vries at gcc dot gnu.org
                   ` (12 preceding siblings ...)
  2024-05-22  8:06 ` cvs-commit at gcc dot gnu.org
@ 2024-05-27 14:02 ` clyon at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: clyon at gcc dot gnu.org @ 2024-05-27 14:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115066

Christophe Lyon <clyon at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clyon at gcc dot gnu.org

--- Comment #14 from Christophe Lyon <clyon at gcc dot gnu.org> ---
The testcase was also updated by:
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=c1356e8cc9a8c869ab936c927b1812b4691265b6

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2024-05-27 14:02 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-13  8:40 [Bug debug/115066] New: [debug, gsplit-dwarf, gdwarf-4, g3] DW_MACRO_define_strp used for debug_str_offsets index vries at gcc dot gnu.org
2024-05-13  8:42 ` [Bug debug/115066] " vries at gcc dot gnu.org
2024-05-13  9:12 ` vries at gcc dot gnu.org
2024-05-13 10:27 ` rguenth at gcc dot gnu.org
2024-05-13 10:29 ` vries at gcc dot gnu.org
2024-05-13 10:33 ` jakub at gcc dot gnu.org
2024-05-13 11:11 ` vries at gcc dot gnu.org
2024-05-14 11:35 ` vries at gcc dot gnu.org
2024-05-14 12:00 ` cvs-commit at gcc dot gnu.org
2024-05-14 12:04 ` vries at gcc dot gnu.org
2024-05-16  8:35 ` ro at gcc dot gnu.org
2024-05-16  9:06 ` vries at gcc dot gnu.org
2024-05-16  9:22 ` ro at CeBiTec dot Uni-Bielefeld.DE
2024-05-22  8:06 ` cvs-commit at gcc dot gnu.org
2024-05-27 14:02 ` clyon at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).