From 7235427998571b6d8267e7ac72a52d7b082f4c2b Mon Sep 17 00:00:00 2001 From: Christian Eggers Date: Sun, 10 Mar 2019 19:21:54 +0100 Subject: [PATCH] dwarf2: Use octets for dwarf2 headers The content of the dwarf2 sections .debug_line, .debug_aranges and .debug_info starts with an u32 containing the the size of the remaining data. According to the dwarf2 specification this value must be expressed in octets instead of bytes. * dwarf2dbg.c (out_debug_line): Use octets for dwarf2 headers. (out_debug_aranges, out_debug_info): Likewise. --- gas/ChangeLog | 5 +++++ gas/dwarf2dbg.c | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 274516cfd41..a03bf3bb56e 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2019-03-13 Christian Eggers + + * dwarf2dbg.c (out_debug_line): Use octets for dwarf2 headers. + (out_debug_aranges, out_debug_info): Likewise. + 2019-03-13 Christian Eggers * symbols.h (symbol_temp_new_now_octets): Declare. diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c index 45d86a6ee34..7b0e8fdc4a7 100644 --- a/gas/dwarf2dbg.c +++ b/gas/dwarf2dbg.c @@ -1745,7 +1745,7 @@ out_header (asection *sec, expressionS *exp) } else { - start_sym = symbol_temp_new_now (); + start_sym = symbol_temp_new_now_octets (); end_sym = symbol_temp_make (); } @@ -1848,7 +1848,7 @@ out_debug_line (segT line_seg) in the DWARF Line Number header. */ subseg_set (subseg_get (".debug_line_end", FALSE), 0); - symbol_set_value_now (line_end); + symbol_set_value_now_octets (line_end); } static void @@ -1967,7 +1967,7 @@ out_debug_aranges (segT aranges_seg, segT info_seg) md_number_to_chars (p, 0, addr_size); md_number_to_chars (p + addr_size, 0, addr_size); - symbol_set_value_now (aranges_end); + symbol_set_value_now_octets (aranges_end); } /* Emit data for .debug_abbrev. Note that this must be kept in @@ -2082,7 +2082,7 @@ out_debug_info (segT info_seg, segT abbrev_seg, segT line_seg, segT ranges_seg, dwarf2 draft has no standard code for assembler. */ out_two (DW_LANG_Mips_Assembler); - symbol_set_value_now (info_end); + symbol_set_value_now_octets (info_end); } /* Emit the three debug strings needed in .debug_str and setup symbols -- 2.30.2