aboutsummaryrefslogtreecommitdiff
path: root/gold/dwarf_reader.h
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@gmail.com>2017-11-19 17:56:30 -0800
committerCary Coutant <ccoutant@gmail.com>2017-11-19 17:56:30 -0800
commit20dd9c210ef05fc6e87afe07670d8ceba530a1c5 (patch)
tree45f79e4d65a94b4bc47329e9a9ad19f3bbd85e3b /gold/dwarf_reader.h
parentbde954a064b0a983d1db37cec4777d576d7a9d56 (diff)
downloadgdb-20dd9c210ef05fc6e87afe07670d8ceba530a1c5.zip
gdb-20dd9c210ef05fc6e87afe07670d8ceba530a1c5.tar.gz
gdb-20dd9c210ef05fc6e87afe07670d8ceba530a1c5.tar.bz2
Fix DWARF reader to use correct size for DW_FORM_ref_addr.
2017-11-19 Ian Lance Taylor <iant@google.com> Cary Coutant <ccoutant@gmail.com> gold/ * gold/dwarf_reader.h (class Dwarf_info_reader): Add ref_addr_size method. * gold/dwarf_reader.cc (Dwarf_die::read_attributes): Use ref_addr_size for DW_FORM_ref_addr_size. (Dwarf_die::skip_attributes): Likewise.
Diffstat (limited to 'gold/dwarf_reader.h')
-rw-r--r--gold/dwarf_reader.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/gold/dwarf_reader.h b/gold/dwarf_reader.h
index b41e057..31e76ce 100644
--- a/gold/dwarf_reader.h
+++ b/gold/dwarf_reader.h
@@ -764,6 +764,13 @@ class Dwarf_info_reader
address_size() const
{ return this->address_size_; }
+ // Return the size of a DW_FORM_ref_addr.
+ // In DWARF v2, this was the size of an address; in DWARF v3 and later,
+ // it is the size of an DWARF offset.
+ unsigned int
+ ref_addr_size() const
+ { return this->cu_version_ > 2 ? this->offset_size_ : this->address_size_; }
+
// Set the section index of the .debug_abbrev section.
// We use this if there are no relocations for the .debug_info section.
// If not set, the code parse() routine will search for the section by name.