* [PATCH] gas: Use DW_FORM_sec_offset for DWARF version 4 or higher.
@ 2020-09-01 13:35 Mark Wielaard
2020-09-03 14:46 ` Nick Clifton
0 siblings, 1 reply; 2+ messages in thread
From: Mark Wielaard @ 2020-09-01 13:35 UTC (permalink / raw)
To: binutils; +Cc: Mark Wielaard
Older DWARF versions used DW_FORM_data4 or DW_FORM_data8 for offsets
into sections for e.g. DW_AT_stmt_list ot DW_AT_ranges. But version 4
introduced a dedicated form for such section offsets. Make sure to emit
the proper form for newer DWARF versions.
gas/ChangeLog:
* dwarf2dbg.c (out_debug_abbrev): Use DW_FORM_sec_offset for DWARF
version 4 or higher.
---
gas/ChangeLog | 5 +++++
gas/dwarf2dbg.c | 20 +++++++++++---------
2 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 45c89f5c97c..4655aa891f5 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,8 @@
+2020-09-01 Mark Wielaard <mark@klomp.org>
+
+ * dwarf2dbg.c (out_debug_abbrev): Use DW_FORM_sec_offset for DWARF
+ version 4 or higher.
+
2020-08-28 Mark Wielaard <mark@klomp.org>
* dwarf2dbg.c (dwarf2_directive_filename): Initialize with_md5 to
diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c
index 8a840d0cbf1..30a98e0fc54 100644
--- a/gas/dwarf2dbg.c
+++ b/gas/dwarf2dbg.c
@@ -2429,15 +2429,22 @@ out_debug_abbrev (segT abbrev_seg,
segT info_seg ATTRIBUTE_UNUSED,
segT line_seg ATTRIBUTE_UNUSED)
{
+ int secoff_form;
subseg_set (abbrev_seg, 0);
out_uleb128 (1);
out_uleb128 (DW_TAG_compile_unit);
out_byte (DW_CHILDREN_no);
- if (DWARF2_FORMAT (line_seg) == dwarf2_format_32bit)
- out_abbrev (DW_AT_stmt_list, DW_FORM_data4);
+ if (DWARF2_VERSION < 4)
+ {
+ if (DWARF2_FORMAT (line_seg) == dwarf2_format_32bit)
+ secoff_form = DW_FORM_data4;
+ else
+ secoff_form = DW_FORM_data8;
+ }
else
- out_abbrev (DW_AT_stmt_list, DW_FORM_data8);
+ secoff_form = DW_FORM_sec_offset;
+ out_abbrev (DW_AT_stmt_list, secoff_form);
if (all_segs->next == NULL)
{
out_abbrev (DW_AT_low_pc, DW_FORM_addr);
@@ -2447,12 +2454,7 @@ out_debug_abbrev (segT abbrev_seg,
out_abbrev (DW_AT_high_pc, DW_FORM_udata);
}
else
- {
- if (DWARF2_FORMAT (info_seg) == dwarf2_format_32bit)
- out_abbrev (DW_AT_ranges, DW_FORM_data4);
- else
- out_abbrev (DW_AT_ranges, DW_FORM_data8);
- }
+ out_abbrev (DW_AT_ranges, secoff_form);
out_abbrev (DW_AT_name, DW_FORM_strp);
out_abbrev (DW_AT_comp_dir, DW_FORM_strp);
out_abbrev (DW_AT_producer, DW_FORM_strp);
--
2.18.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] gas: Use DW_FORM_sec_offset for DWARF version 4 or higher.
2020-09-01 13:35 [PATCH] gas: Use DW_FORM_sec_offset for DWARF version 4 or higher Mark Wielaard
@ 2020-09-03 14:46 ` Nick Clifton
0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2020-09-03 14:46 UTC (permalink / raw)
To: Mark Wielaard, binutils
Hi Mark,
> gas/ChangeLog:
>
> * dwarf2dbg.c (out_debug_abbrev): Use DW_FORM_sec_offset for DWARF
> version 4 or higher.
Approved - please apply.
Cheers
Nick
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-03 14:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-01 13:35 [PATCH] gas: Use DW_FORM_sec_offset for DWARF version 4 or higher Mark Wielaard
2020-09-03 14:46 ` Nick Clifton
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).