public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH,DWARF,v2] AIX dwarf2out label fix
@ 2017-05-18 10:09 David Edelsohn
  2017-06-01 19:03 ` Jason Merrill
  0 siblings, 1 reply; 4+ messages in thread
From: David Edelsohn @ 2017-05-18 10:09 UTC (permalink / raw)
  To: GCC Patches

This version adds a macro DWARF_INITIAL_LENGTH_SIZE_STR based on
DWARF_OFFSET_SIZE to define the string expression to append to the
label to correct the offset.

Because AIX Assembler inserts the section length, the section label
generated by GCC points to the wrong location and must be adjusted
when referenced in DW_AT_stmt_list.

Okay?

Thanks, David


        * dwarf2out.c (DWARF_INITIAL_LENGTH_SIZE_STR): New.
        (dwarf2out_finish): Use a local copy of debug_line_section_label.
        On AIX, append an expression to subtract the size of the
section length.


Index: dwarf2out.c
===================================================================
--- dwarf2out.c (revision 248185)
+++ dwarf2out.c (working copy)
@@ -189,6 +189,10 @@
 #define DWARF_INITIAL_LENGTH_SIZE (DWARF_OFFSET_SIZE == 4 ? 4 : 12)
 #endif

+#ifndef DWARF_INITIAL_LENGTH_SIZE_STR
+#define DWARF_INITIAL_LENGTH_SIZE_STR (DWARF_OFFSET_SIZE == 4 ? "-4" : "-12")
+#endif
+
 /* Round SIZE up to the nearest BOUNDARY.  */
 #define DWARF_ROUND(SIZE,BOUNDARY) \
   ((((SIZE) + (BOUNDARY) - 1) / (BOUNDARY)) * (BOUNDARY))
@@ -29650,6 +29654,7 @@
   comdat_type_node *ctnode;
   dw_die_ref main_comp_unit_die;
   unsigned char checksum[16];
+  char dl_section_label[MAX_ARTIFICIAL_LABEL_BYTES];

   /* Flush out any latecomers to the limbo party.  */
   flush_limbo_die_list ();
@@ -29767,9 +29772,13 @@
        }
     }

+  strcpy (dl_section_label, debug_line_section_label);
+  if (XCOFF_DEBUGGING_INFO)
+    strcat (dl_section_label, DWARF_INITIAL_LENGTH_SIZE_STR);
+
   if (debug_info_level >= DINFO_LEVEL_TERSE)
     add_AT_lineptr (main_comp_unit_die, DW_AT_stmt_list,
-                   debug_line_section_label);
+                   dl_section_label);

   if (have_macinfo)
     add_AT_macptr (comp_unit_die (),
@@ -29845,7 +29854,7 @@
       if (debug_info_level >= DINFO_LEVEL_TERSE)
         add_AT_lineptr (ctnode->root_die, DW_AT_stmt_list,
                         (!dwarf_split_debug_info
-                         ? debug_line_section_label
+                         ? dl_section_label
                          : debug_skeleton_line_section_label));

       output_comdat_type_unit (ctnode);

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

* Re: [PATCH,DWARF,v2] AIX dwarf2out label fix
  2017-05-18 10:09 [PATCH,DWARF,v2] AIX dwarf2out label fix David Edelsohn
@ 2017-06-01 19:03 ` Jason Merrill
  2017-06-01 19:27   ` David Edelsohn
  0 siblings, 1 reply; 4+ messages in thread
From: Jason Merrill @ 2017-06-01 19:03 UTC (permalink / raw)
  To: David Edelsohn, GCC Patches

On 05/18/2017 06:00 AM, David Edelsohn wrote:
> This version adds a macro DWARF_INITIAL_LENGTH_SIZE_STR based on
> DWARF_OFFSET_SIZE to define the string expression to append to the
> label to correct the offset.
> 
> Because AIX Assembler inserts the section length, the section label
> generated by GCC points to the wrong location and must be adjusted
> when referenced in DW_AT_stmt_list.
> 
> +  char dl_section_label[MAX_ARTIFICIAL_LABEL_BYTES];

It seems inaccurate to call this variable "label" when it's a label name 
minus offset.  Maybe dl_section_ref?

>         if (debug_info_level >= DINFO_LEVEL_TERSE)
>           add_AT_lineptr (ctnode->root_die, DW_AT_stmt_list,
>                           (!dwarf_split_debug_info
> -                         ? debug_line_section_label
> +                         ? dl_section_label
>                            : debug_skeleton_line_section_label));

Doesn't debug_skeleton_line_section_label need the same offset?

Jason

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

* Re: [PATCH,DWARF,v2] AIX dwarf2out label fix
  2017-06-01 19:03 ` Jason Merrill
@ 2017-06-01 19:27   ` David Edelsohn
  2017-06-01 20:16     ` Jason Merrill
  0 siblings, 1 reply; 4+ messages in thread
From: David Edelsohn @ 2017-06-01 19:27 UTC (permalink / raw)
  To: Jason Merrill; +Cc: GCC Patches

On Thu, Jun 1, 2017 at 3:03 PM, Jason Merrill <jason@redhat.com> wrote:
> On 05/18/2017 06:00 AM, David Edelsohn wrote:
>>
>> This version adds a macro DWARF_INITIAL_LENGTH_SIZE_STR based on
>> DWARF_OFFSET_SIZE to define the string expression to append to the
>> label to correct the offset.
>>
>> Because AIX Assembler inserts the section length, the section label
>> generated by GCC points to the wrong location and must be adjusted
>> when referenced in DW_AT_stmt_list.
>>
>> +  char dl_section_label[MAX_ARTIFICIAL_LABEL_BYTES];
>
> It seems inaccurate to call this variable "label" when it's a label name
> minus offset.  Maybe dl_section_ref?

Hi, Jason

Thanks for taking a look at this!

Any naming suggestions are appreciated -- I was trying to choose a
short variable name.  dl_section_ref is fine with me.

>
>>         if (debug_info_level >= DINFO_LEVEL_TERSE)
>>           add_AT_lineptr (ctnode->root_die, DW_AT_stmt_list,
>>                           (!dwarf_split_debug_info
>> -                         ? debug_line_section_label
>> +                         ? dl_section_label
>>                            : debug_skeleton_line_section_label));
>
>
> Doesn't debug_skeleton_line_section_label need the same offset?

AIX doesn't support DWARF split debug info, so it did not seem
worthwhile to clutter the code.  I am trying to make the minimal
changes for AIX's peculiar DWARF implementation.

Thanks, David

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

* Re: [PATCH,DWARF,v2] AIX dwarf2out label fix
  2017-06-01 19:27   ` David Edelsohn
@ 2017-06-01 20:16     ` Jason Merrill
  0 siblings, 0 replies; 4+ messages in thread
From: Jason Merrill @ 2017-06-01 20:16 UTC (permalink / raw)
  To: David Edelsohn; +Cc: GCC Patches

On Thu, Jun 1, 2017 at 3:27 PM, David Edelsohn <dje.gcc@gmail.com> wrote:
> On Thu, Jun 1, 2017 at 3:03 PM, Jason Merrill <jason@redhat.com> wrote:
>> On 05/18/2017 06:00 AM, David Edelsohn wrote:
>>>
>>> This version adds a macro DWARF_INITIAL_LENGTH_SIZE_STR based on
>>> DWARF_OFFSET_SIZE to define the string expression to append to the
>>> label to correct the offset.
>>>
>>> Because AIX Assembler inserts the section length, the section label
>>> generated by GCC points to the wrong location and must be adjusted
>>> when referenced in DW_AT_stmt_list.
>>>
>>> +  char dl_section_label[MAX_ARTIFICIAL_LABEL_BYTES];
>>
>> It seems inaccurate to call this variable "label" when it's a label name
>> minus offset.  Maybe dl_section_ref?
>
> Hi, Jason
>
> Thanks for taking a look at this!
>
> Any naming suggestions are appreciated -- I was trying to choose a
> short variable name.  dl_section_ref is fine with me.

Let's go with that, then.  OK with that change.

Jason

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

end of thread, other threads:[~2017-06-01 20:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-18 10:09 [PATCH,DWARF,v2] AIX dwarf2out label fix David Edelsohn
2017-06-01 19:03 ` Jason Merrill
2017-06-01 19:27   ` David Edelsohn
2017-06-01 20:16     ` Jason Merrill

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).