Add support for DWARF-4 line number tables.
authorCary Coutant <ccoutant@gmail.com>
Sat, 3 Feb 2018 01:44:27 +0000 (17:44 -0800)
committerCary Coutant <ccoutant@gmail.com>
Sat, 3 Feb 2018 01:44:27 +0000 (17:44 -0800)
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.

gold/ChangeLog
gold/dwarf_reader.cc
gold/dwarf_reader.h

index b833a7b36306bc63df40f17661b22da39fdd20ed..b341fd2e73307ae478e520c9e5c5e9f49901da58 100644 (file)
@@ -1,3 +1,10 @@
+2018-02-02  Cary Coutant  <ccoutant@gmail.com>
+
+       * 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  <amodra@gmail.com>
 
        * powerpc.cc (param_plt_align): New function supplying default
index 63502479ebeebf81fb5b94f361af962fbdcb42a7..5cdb0b2525b5479f19cf295cd18c88da3740cbd0 100644 (file)
@@ -1667,6 +1667,17 @@ Sized_dwarf_line_info<size, big_endian>::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;
 
index f994bf2b08e0668484c1a4dec56aea094c507abf..8c969236f1c3c60689adc3fef338bec124f7ea24 100644 (file)
@@ -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;