public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH,DWARF] AIX dwarf2out label fix
@ 2017-05-17  1:55 David Edelsohn
  0 siblings, 0 replies; only message in thread
From: David Edelsohn @ 2017-05-17  1:55 UTC (permalink / raw)
  To: GCC Patches

The AIX Assembler inserts the DWARF section lengths itself.
dwarf2out.c previously has been modified to not emit the length on
AIX.  All well and good until GCC emits a label that it believes
references the start of a DWARF section, but actually references an
address _after_ the section length inserted by AIX.

        .dwsect 0x20000
<AIX inserts section length>
Ldebug_line0:
        .vbyte 2,0x4
        ....

This particular issue causes an incorrect offset for DW_AT_stmt_list.

The following patch adjusts the reference to the label on AIX to
subtract the size of the section length information, which makes GDB
much happier.

Bootstrapped on powerpc-ibm-aix7.2.0.0

Okay?

Thanks, David

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

Index: dwarf2out.c
===================================================================
--- dwarf2out.c (revision 248131)
+++ dwarf2out.c (working copy)
@@ -29650,6 +29650,7 @@ dwarf2out_finish (const char *)
   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 +29768,13 @@ dwarf2out_finish (const char *)
        }
     }

+  strcpy (dl_section_label, debug_line_section_label);
+  if (XCOFF_DEBUGGING_INFO)
+    strcat (dl_section_label, TARGET_64BIT ? "-12" : "-4");
+
   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 +29850,7 @@ dwarf2out_finish (const char *)
       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] only message in thread

only message in thread, other threads:[~2017-05-17  1:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-17  1:55 [PATCH,DWARF] AIX dwarf2out label fix David Edelsohn

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