From: Cary Coutant Date: Sat, 3 Feb 2018 01:44:27 +0000 (-0800) Subject: Add support for DWARF-4 line number tables. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c83344582375e65643c5efe68b3739e87db482f3;p=binutils-gdb.git 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. --- diff --git a/gold/ChangeLog b/gold/ChangeLog index b833a7b3630..b341fd2e733 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,10 @@ +2018-02-02 Cary Coutant + + * 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. + 2018-01-18 Alan Modra * powerpc.cc (param_plt_align): New function supplying default diff --git a/gold/dwarf_reader.cc b/gold/dwarf_reader.cc index 63502479ebe..5cdb0b2525b 100644 --- a/gold/dwarf_reader.cc +++ b/gold/dwarf_reader.cc @@ -1667,6 +1667,17 @@ Sized_dwarf_line_info::read_header_prolog( header_.min_insn_length = *lineptr; lineptr += 1; + if (header_.version < 4) + header_.max_ops_per_insn = 1; + else + { + // DWARF 4 added the maximum_operations_per_instruction field. + header_.max_ops_per_insn = *lineptr; + lineptr += 1; + // TODO: Add support for values other than 1. + gold_assert(header_.max_ops_per_insn == 1); + } + header_.default_is_stmt = *lineptr; lineptr += 1; diff --git a/gold/dwarf_reader.h b/gold/dwarf_reader.h index f994bf2b08e..8c969236f1c 100644 --- a/gold/dwarf_reader.h +++ b/gold/dwarf_reader.h @@ -1070,7 +1070,8 @@ class Sized_dwarf_line_info : public Dwarf_line_info off_t total_length; int version; off_t prologue_length; - int min_insn_length; // insn stands for instructin + int min_insn_length; // insn stands for instruction + int max_ops_per_insn; // Added in DWARF-4. bool default_is_stmt; // stmt stands for statement signed char line_base; int line_range;