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