+2022-08-25 Nick Clifton <nickc@redhat.com>
+
+ PR 29517
+ * dwarf2dbg.c (GAS_ABBREV_COMP_UNIT): New defined constant.
+ (GAS_ABBREV_SUBPROG): New defined constant.
+ (GAS_ABBREV_NO_TYPE): New defined constant.
+ (out_debug_abbrev): Use the new defined constants when emitting
+ abbreviation numbers. Generate an abbreviation for an unspecified
+ type.
+ (out_debug_info): Use the new defined constants when referring to
+ abbreviations. Generate a use of the no_type abbreviation.
+ Reference the use when generating DIEs for functions.
+ * testsuite/gas/elf/dwarf-3-func.d: Update to allow for newly
+ extended output from the assembler.
+ * testsuite/gas/elf/dwarf-5-func-global.d: Likewise.
+ * testsuite/gas/elf/dwarf-5-func-local.d: Likewise.
+ * testsuite/gas/elf/dwarf-5-func.d: Likewise.
+
2022-08-25 Nick Clifton <nickc@redhat.com>
PR 29519
#define TC_PARSE_CONS_RETURN_NONE BFD_RELOC_NONE
#endif
+#define GAS_ABBREV_COMP_UNIT 1
+#define GAS_ABBREV_SUBPROG 2
+#define GAS_ABBREV_NO_TYPE 3
+
struct line_entry
{
struct line_entry *next;
subseg_set (abbrev_seg, 0);
- out_uleb128 (1);
+ out_uleb128 (GAS_ABBREV_COMP_UNIT);
out_uleb128 (DW_TAG_compile_unit);
out_byte (have_efunc || have_lfunc ? DW_CHILDREN_yes : DW_CHILDREN_no);
if (DWARF2_VERSION < 4)
if (have_efunc || have_lfunc)
{
- out_uleb128 (2);
+ out_uleb128 (GAS_ABBREV_SUBPROG);
out_uleb128 (DW_TAG_subprogram);
out_byte (DW_CHILDREN_no);
out_abbrev (DW_AT_name, DW_FORM_strp);
else
/* Any non-zero value other than DW_FORM_flag will do. */
*func_formP = DW_FORM_block;
+
+ /* PR 29517: Provide a return type for the function. */
+ if (DWARF2_VERSION > 2)
+ out_abbrev (DW_AT_type, DW_FORM_ref_udata);
+
out_abbrev (DW_AT_low_pc, DW_FORM_addr);
out_abbrev (DW_AT_high_pc,
DWARF2_VERSION < 4 ? DW_FORM_addr : DW_FORM_udata);
out_abbrev (0, 0);
+
+ if (DWARF2_VERSION > 2)
+ {
+ /* PR 29517: We do not actually know the return type of these
+ functions, so provide an abbrev that uses DWARF's unspecified
+ type. */
+ out_uleb128 (GAS_ABBREV_NO_TYPE);
+ out_uleb128 (DW_TAG_unspecified_type);
+ out_byte (DW_CHILDREN_no);
+ out_abbrev (0, 0);
+ }
}
/* Terminate the abbreviations for this compilation unit. */
expressionS exp;
symbolS *info_end;
int sizeof_offset;
+ valueT no_type_die = 0;
memset (&exp, 0, sizeof exp);
sizeof_offset = out_header (info_seg, &exp);
TC_DWARF2_EMIT_OFFSET (section_symbol (abbrev_seg), sizeof_offset);
}
+ if (func_form && DWARF2_VERSION > 2)
+ {
+ /* PR 29517: Generate a DIE for the unspecified type abbrev.
+ We do it here so that the offset from the start of the
+ section is fixed. */
+ subseg_set (info_seg, 0);
+ no_type_die = frag_now_fix_octets ();
+ out_uleb128 (GAS_ABBREV_NO_TYPE);
+ }
+
/* DW_TAG_compile_unit DIE abbrev */
- out_uleb128 (1);
+ out_uleb128 (GAS_ABBREV_COMP_UNIT);
/* DW_AT_stmt_list */
TC_DWARF2_EMIT_OFFSET (section_symbol (line_seg),
subseg_set (info_seg, 0);
/* DW_TAG_subprogram DIE abbrev */
- out_uleb128 (2);
+ out_uleb128 (GAS_ABBREV_SUBPROG);
/* DW_AT_name */
TC_DWARF2_EMIT_OFFSET (name_sym, sizeof_offset);
if (func_form == DW_FORM_flag)
out_byte (S_IS_EXTERNAL (symp));
+ /* PR 29517: Let consumers know that we do not
+ have return type information for this function. */
+ if (DWARF2_VERSION > 2)
+ out_uleb128 (no_type_die);
+
/* DW_AT_low_pc */
exp.X_op = O_symbol;
exp.X_add_symbol = symp;
+Version: +3
+Abbrev Offset: +(0x)?0
+Pointer Size: .*
+ <0><[0-9a-f]+>: Abbrev Number: 3 \(DW_TAG_unspecified_type\)
+#...
<0><[0-9a-f]+>: Abbrev Number: 1 \(DW_TAG_compile_unit\)
#...
<1><[0-9a-f]+>: Abbrev Number: 2 \(DW_TAG_subprogram\)
+<[0-9a-f]+> +DW_AT_name +: \(strp\) \(offset: (0x)?[0-9a-f]+\): efunc1
+<[0-9a-f]+> +DW_AT_external +: \(flag\) 1
+ +<[0-9a-f]+> +DW_AT_type +: \(ref_udata\) <0x.>
+<[0-9a-f]+> +DW_AT_low_pc +: \(addr\) (0x)?0
+<[0-9a-f]+> +DW_AT_high_pc +: \(addr\) (0x)?2
<1><[0-9a-f]+>: Abbrev Number: 2 \(DW_TAG_subprogram\)
+<[0-9a-f]+> +DW_AT_name +: \(strp\) \(offset: (0x)?[0-9a-f]+\): lfunc1
+<[0-9a-f]+> +DW_AT_external +: \(flag\) 0
+ +<[0-9a-f]+> +DW_AT_type +: \(ref_udata\) <0x.>
+<[0-9a-f]+> +DW_AT_low_pc +: \(addr\) (0x)?2
+<[0-9a-f]+> +DW_AT_high_pc +: \(addr\) (0x)?13
<1><[0-9a-f]+>: Abbrev Number: 2 \(DW_TAG_subprogram\)
+<[0-9a-f]+> +DW_AT_name +: \(strp\) \(offset: (0x)?[0-9a-f]+\): efunc2
+<[0-9a-f]+> +DW_AT_external +: \(flag\) 1
+ +<[0-9a-f]+> +DW_AT_type +: \(ref_udata\) <0x.>
+<[0-9a-f]+> +DW_AT_low_pc +: \(addr\) (0x)?13
+<[0-9a-f]+> +DW_AT_high_pc +: \(addr\) (0x)?35
<1><[0-9a-f]+>: Abbrev Number: 2 \(DW_TAG_subprogram\)
+<[0-9a-f]+> +DW_AT_name +: \(strp\) \(offset: (0x)?[0-9a-f]+\): lfunc2
+<[0-9a-f]+> +DW_AT_external +: \(flag\) 0
+ +<[0-9a-f]+> +DW_AT_type +: \(ref_udata\) <0x.>
+<[0-9a-f]+> +DW_AT_low_pc +: \(addr\) (0x)?35
+<[0-9a-f]+> +DW_AT_high_pc +: \(addr\) (0x)?38
<1><[0-9a-f]+>: Abbrev Number: 0
+2 +DW_TAG_subprogram +\[no children\]
+DW_AT_name +DW_FORM_strp
+DW_AT_external +DW_FORM_flag
+ +DW_AT_type +DW_FORM_ref_udata
+DW_AT_low_pc +DW_FORM_addr
+DW_AT_high_pc +DW_FORM_addr
+DW_AT value: 0 +DW_FORM value: 0
+Unit Type: +DW_UT_compile \(1\)
+Abbrev Offset: +(0x)?0
+Pointer Size: .*
+ <0><[0-9a-f]+>: Abbrev Number: 3 \(DW_TAG_unspecified_type\)
+#...
<0><[0-9a-f]+>: Abbrev Number: 1 \(DW_TAG_compile_unit\)
#...
<1><[0-9a-f]+>: Abbrev Number: 2 \(DW_TAG_subprogram\)
+<[0-9a-f]+> +DW_AT_name +: \(strp\) \(offset: (0x)?[0-9a-f]+\): efunc1
+<[0-9a-f]+> +DW_AT_external +: \(flag_present\) 1
+ +<[0-9a-f]+> +DW_AT_type +: \(ref_udata\) <0x.>
+<[0-9a-f]+> +DW_AT_low_pc +: \(addr\) (0x)?0
+<[0-9a-f]+> +DW_AT_high_pc +: \(udata\) 2
<1><[0-9a-f]+>: Abbrev Number: 2 \(DW_TAG_subprogram\)
+<[0-9a-f]+> +DW_AT_name +: \(strp\) \(offset: (0x)?[0-9a-f]+\): efunc2
+<[0-9a-f]+> +DW_AT_external +: \(flag_present\) 1
+ +<[0-9a-f]+> +DW_AT_type +: \(ref_udata\) <0x.>
+<[0-9a-f]+> +DW_AT_low_pc +: \(addr\) (0x)?2
+<[0-9a-f]+> +DW_AT_high_pc +: \(udata\) 34
<1><[0-9a-f]+>: Abbrev Number: 0
+2 +DW_TAG_subprogram +\[no children\]
+DW_AT_name +DW_FORM_strp
+DW_AT_external +DW_FORM_flag_present
+ +DW_AT_type +DW_FORM_ref_udata
+DW_AT_low_pc +DW_FORM_addr
+DW_AT_high_pc +DW_FORM_udata
+DW_AT value: 0 +DW_FORM value: 0
+Unit Type: +DW_UT_compile \(1\)
+Abbrev Offset: +(0x)?0
+Pointer Size: .*
+ <0><[0-9a-f]+>: Abbrev Number: 3 \(DW_TAG_unspecified_type\)
+#...
<0><[0-9a-f]+>: Abbrev Number: 1 \(DW_TAG_compile_unit\)
#...
<1><[0-9a-f]+>: Abbrev Number: 2 \(DW_TAG_subprogram\)
+<[0-9a-f]+> +DW_AT_name +: \(strp\) \(offset: (0x)?[0-9a-f]+\): lfunc1
+ +<[0-9a-f]+> +DW_AT_type +: \(ref_udata\) <0x.>
+<[0-9a-f]+> +DW_AT_low_pc +: \(addr\) (0x)?0
+<[0-9a-f]+> +DW_AT_high_pc +: \(udata\) 17
<1><[0-9a-f]+>: Abbrev Number: 2 \(DW_TAG_subprogram\)
+<[0-9a-f]+> +DW_AT_name +: \(strp\) \(offset: (0x)?[0-9a-f]+\): lfunc2
+ +<[0-9a-f]+> +DW_AT_type +: \(ref_udata\) <0x.>
+<[0-9a-f]+> +DW_AT_low_pc +: \(addr\) (0x)?11
+<[0-9a-f]+> +DW_AT_high_pc +: \(udata\) 3
<1><[0-9a-f]+>: Abbrev Number: 0
#...
+2 +DW_TAG_subprogram +\[no children\]
+DW_AT_name +DW_FORM_strp
+ +DW_AT_type +DW_FORM_ref_udata
+DW_AT_low_pc +DW_FORM_addr
+DW_AT_high_pc +DW_FORM_udata
+DW_AT value: 0 +DW_FORM value: 0
+Unit Type: +DW_UT_compile \(1\)
+Abbrev Offset: +(0x)?0
+Pointer Size: .*
+ <0><[0-9a-f]+>: Abbrev Number: 3 \(DW_TAG_unspecified_type\)
+#...
<0><[0-9a-f]+>: Abbrev Number: 1 \(DW_TAG_compile_unit\)
#...
<1><[0-9a-f]+>: Abbrev Number: 2 \(DW_TAG_subprogram\)
+<[0-9a-f]+> +DW_AT_name +: \(strp\) \(offset: (0x)?[0-9a-f]+\): efunc1
+<[0-9a-f]+> +DW_AT_external +: \(flag\) 1
+ +<[0-9a-f]+> +DW_AT_type +: \(ref_udata\) <0x.>
+<[0-9a-f]+> +DW_AT_low_pc +: \(addr\) (0x)?0
+<[0-9a-f]+> +DW_AT_high_pc +: \(udata\) 2
<1><[0-9a-f]+>: Abbrev Number: 2 \(DW_TAG_subprogram\)
+<[0-9a-f]+> +DW_AT_name +: \(strp\) \(offset: (0x)?[0-9a-f]+\): lfunc1
+<[0-9a-f]+> +DW_AT_external +: \(flag\) 0
+ +<[0-9a-f]+> +DW_AT_type +: \(ref_udata\) <0x.>
+<[0-9a-f]+> +DW_AT_low_pc +: \(addr\) (0x)?2
+<[0-9a-f]+> +DW_AT_high_pc +: \(udata\) 17
<1><[0-9a-f]+>: Abbrev Number: 2 \(DW_TAG_subprogram\)
+<[0-9a-f]+> +DW_AT_name +: \(strp\) \(offset: (0x)?[0-9a-f]+\): efunc2
+<[0-9a-f]+> +DW_AT_external +: \(flag\) 1
+ +<[0-9a-f]+> +DW_AT_type +: \(ref_udata\) <0x.>
+<[0-9a-f]+> +DW_AT_low_pc +: \(addr\) (0x)?13
+<[0-9a-f]+> +DW_AT_high_pc +: \(udata\) 34
<1><[0-9a-f]+>: Abbrev Number: 2 \(DW_TAG_subprogram\)
+<[0-9a-f]+> +DW_AT_name +: \(strp\) \(offset: (0x)?[0-9a-f]+\): lfunc2
+<[0-9a-f]+> +DW_AT_external +: \(flag\) 0
+ +<[0-9a-f]+> +DW_AT_type +: \(ref_udata\) <0x.>
+<[0-9a-f]+> +DW_AT_low_pc +: \(addr\) (0x)?35
+<[0-9a-f]+> +DW_AT_high_pc +: \(udata\) 3
<1><[0-9a-f]+>: Abbrev Number: 0
+2 +DW_TAG_subprogram +\[no children\]
+DW_AT_name +DW_FORM_strp
+DW_AT_external +DW_FORM_flag
+ +DW_AT_type +DW_FORM_ref_udata
+DW_AT_low_pc +DW_FORM_addr
+DW_AT_high_pc +DW_FORM_udata
+DW_AT value: 0 +DW_FORM value: 0