aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2021-01-28 04:21:15 -0800
committerH.J. Lu <hjl.tools@gmail.com>2021-01-28 04:38:03 -0800
commit756beae66817dcf3794028cb49c8371f4ba54bfa (patch)
tree501e0a25d53643fe153faf5490447379b0a80024
parentPOWER10: Add Return-Oriented Programming instructions (diff)
downloadbinutils-gdb-756beae66817dcf3794028cb49c8371f4ba54bfa.tar.gz
binutils-gdb-756beae66817dcf3794028cb49c8371f4ba54bfa.tar.bz2
binutils-gdb-756beae66817dcf3794028cb49c8371f4ba54bfa.zip
gold: Skip address size and segment selector for DWARF5
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. (cherry picked from commit 0318cca4934fc5d85e83351842985ad2a3475146)
-rw-r--r--gold/ChangeLog6
-rw-r--r--gold/dwarf_reader.cc4
2 files changed, 10 insertions, 0 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index ea4927330e..3157932f22 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -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-03 Alan Modra <amodra@gmail.com>
PR 27140
diff --git a/gold/dwarf_reader.cc b/gold/dwarf_reader.cc
index ac9fbad548..ba60654393 100644
--- a/gold/dwarf_reader.cc
+++ b/gold/dwarf_reader.cc
@@ -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