gold: Skip address size and segment selector for DWARF5
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 28 Jan 2021 12:21:15 +0000 (04:21 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 28 Jan 2021 12:21:31 +0000 (04:21 -0800)
The .debug_line secton in DWARF5 has a byte for address size and a byte
for segment selector after DWARF version.  Skip them for DWARF5.

PR gold/27246
* dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog):
Skip address size and segment selector for DWARF5.

gold/ChangeLog
gold/dwarf_reader.cc

index 64f7b78a00b993738bb8755775b8bd19fbd5a46e..5180c02f26090d2bda563e1a75d218a1ca8dc143 100644 (file)
@@ -1,3 +1,9 @@
+2021-01-28  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR gold/27246
+       * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog):
+       Skip address size and segment selector for DWARF5.
+
 2021-01-19  Alan Modra  <amodra@gmail.com>
 
        PR 27203
index 487376965db763fc62bdaa64b5057bcee75a1992..f0e6b89bde2fb791bcd6479e07d6d142f9397380 100644 (file)
@@ -1658,6 +1658,10 @@ Sized_dwarf_line_info<size, big_endian>::read_header_prolog(
   header_.version = elfcpp::Swap_unaligned<16, big_endian>::readval(lineptr);
   lineptr += 2;
 
+  // Skip address size and segment selector for DWARF5.
+  if (header_.version >= 5)
+    lineptr += 2;
+
   if (header_.offset_size == 4)
     header_.prologue_length = elfcpp::Swap_unaligned<32, big_endian>::readval(lineptr);
   else