Skip to content
This repository was archived by the owner on May 29, 2025. It is now read-only.

Commit c833445

Browse files
committed
Add support for DWARF-4 line number tables.
Reads the maximum_operations_per_instruction field, added in DWARF-4 to the line number program header. gold/ * PR gold/22776 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog): Add support for DWARF-4 line number tables. * dwarf_reader.h (Sized_dwarf_line_info::max_ops_per_insn): New field.
1 parent d73daf8 commit c833445

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

gold/ChangeLog

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2018-02-02 Cary Coutant <[email protected]>
2+
3+
* PR gold/22776
4+
* dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog): Add
5+
support for DWARF-4 line number tables.
6+
* dwarf_reader.h (Sized_dwarf_line_info::max_ops_per_insn): New field.
7+
18
2018-01-18 Alan Modra <[email protected]>
29

310
* powerpc.cc (param_plt_align): New function supplying default

gold/dwarf_reader.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,6 +1667,17 @@ Sized_dwarf_line_info<size, big_endian>::read_header_prolog(
16671667
header_.min_insn_length = *lineptr;
16681668
lineptr += 1;
16691669

1670+
if (header_.version < 4)
1671+
header_.max_ops_per_insn = 1;
1672+
else
1673+
{
1674+
// DWARF 4 added the maximum_operations_per_instruction field.
1675+
header_.max_ops_per_insn = *lineptr;
1676+
lineptr += 1;
1677+
// TODO: Add support for values other than 1.
1678+
gold_assert(header_.max_ops_per_insn == 1);
1679+
}
1680+
16701681
header_.default_is_stmt = *lineptr;
16711682
lineptr += 1;
16721683

gold/dwarf_reader.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,8 @@ class Sized_dwarf_line_info : public Dwarf_line_info
10701070
off_t total_length;
10711071
int version;
10721072
off_t prologue_length;
1073-
int min_insn_length; // insn stands for instructin
1073+
int min_insn_length; // insn stands for instruction
1074+
int max_ops_per_insn; // Added in DWARF-4.
10741075
bool default_is_stmt; // stmt stands for statement
10751076
signed char line_base;
10761077
int line_range;

0 commit comments

Comments
 (0)