diff options
author | emaste <emaste@FreeBSD.org> | 2013-10-17 17:25:00 +0000 |
---|---|---|
committer | emaste <emaste@FreeBSD.org> | 2013-10-17 17:25:00 +0000 |
commit | 2ba2e395d963b496a07045622a9b5823de938a62 (patch) | |
tree | 4bcbb7fe1a48c30b4a895a5da2e7cbbaa9681ffe /contrib/binutils | |
parent | 9b6dd10f0c8d84491d0e93705bf7905e098ee2e8 (diff) | |
download | FreeBSD-src-2ba2e395d963b496a07045622a9b5823de938a62.zip FreeBSD-src-2ba2e395d963b496a07045622a9b5823de938a62.tar.gz |
Fix .debug_line prologue header length calculation for 64-bit DWARF
The header_length field is the number of bytes following the field to
the first byte of the line number program. The hard-coded constants
previously here (4 + 2 + 4) were correct only for 32-bit DWARF.
Sponsored by: DARPA, AFRL
Diffstat (limited to 'contrib/binutils')
-rw-r--r-- | contrib/binutils/gas/dwarf2dbg.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/contrib/binutils/gas/dwarf2dbg.c b/contrib/binutils/gas/dwarf2dbg.c index 671a9b0..528f676 100644 --- a/contrib/binutils/gas/dwarf2dbg.c +++ b/contrib/binutils/gas/dwarf2dbg.c @@ -1271,6 +1271,7 @@ out_debug_line (segT line_seg) symbolS *line_end; struct line_seg *s; enum dwarf2_format d2f; + int sizeof_initial_length; int sizeof_offset; subseg_set (line_seg, 0); @@ -1287,27 +1288,24 @@ out_debug_line (segT line_seg) d2f = DWARF2_FORMAT (); if (d2f == dwarf2_format_32bit) { - expr.X_add_number = -4; - emit_expr (&expr, 4); - sizeof_offset = 4; + sizeof_initial_length = sizeof_offset = 4; } else if (d2f == dwarf2_format_64bit) { - expr.X_add_number = -12; - out_four (-1); - emit_expr (&expr, 8); + sizeof_initial_length = 12; sizeof_offset = 8; + out_four (-1); } else if (d2f == dwarf2_format_64bit_irix) { - expr.X_add_number = -8; - emit_expr (&expr, 8); - sizeof_offset = 8; + sizeof_initial_length = sizeof_offset = 8; } else { as_fatal (_("internal error: unknown dwarf2 format")); } + expr.X_add_number = -sizeof_initial_length; + emit_expr (&expr, sizeof_offset); /* Version. */ out_two (2); @@ -1316,7 +1314,7 @@ out_debug_line (segT line_seg) expr.X_op = O_subtract; expr.X_add_symbol = prologue_end; expr.X_op_symbol = line_start; - expr.X_add_number = - (4 + 2 + 4); + expr.X_add_number = - (sizeof_initial_length + 2 + sizeof_offset); emit_expr (&expr, sizeof_offset); /* Parameters of the state machine. */ |