diff options
author | Cary Coutant <ccoutant@gmail.com> | 2017-11-19 17:56:30 -0800 |
---|---|---|
committer | Cary Coutant <ccoutant@gmail.com> | 2017-11-19 17:56:30 -0800 |
commit | 20dd9c210ef05fc6e87afe07670d8ceba530a1c5 (patch) | |
tree | 45f79e4d65a94b4bc47329e9a9ad19f3bbd85e3b /gold/dwarf_reader.cc | |
parent | bde954a064b0a983d1db37cec4777d576d7a9d56 (diff) | |
download | binutils-20dd9c210ef05fc6e87afe07670d8ceba530a1c5.zip binutils-20dd9c210ef05fc6e87afe07670d8ceba530a1c5.tar.gz binutils-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.cc')
-rw-r--r-- | gold/dwarf_reader.cc | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/gold/dwarf_reader.cc b/gold/dwarf_reader.cc index 8c0d593..4da9c1e 100644 --- a/gold/dwarf_reader.cc +++ b/gold/dwarf_reader.cc @@ -737,7 +737,6 @@ Dwarf_die::read_attributes() break; } case elfcpp::DW_FORM_addr: - case elfcpp::DW_FORM_ref_addr: { off_t sec_off; if (this->dwinfo_->address_size() == 4) @@ -751,6 +750,20 @@ Dwarf_die::read_attributes() ref_form = true; break; } + case elfcpp::DW_FORM_ref_addr: + { + off_t sec_off; + if (this->dwinfo_->ref_addr_size() == 4) + sec_off = this->dwinfo_->read_from_pointer<32>(&pattr); + else + sec_off = this->dwinfo_->read_from_pointer<64>(&pattr); + unsigned int shndx = + this->dwinfo_->lookup_reloc(attr_off, &sec_off); + attr_value.aux.shndx = shndx; + attr_value.val.refval = sec_off; + ref_form = true; + break; + } case elfcpp::DW_FORM_block1: attr_value.aux.blocklen = *pattr++; attr_value.val.blockval = pattr; @@ -947,9 +960,11 @@ Dwarf_die::skip_attributes() pattr += this->dwinfo_->offset_size(); break; case elfcpp::DW_FORM_addr: - case elfcpp::DW_FORM_ref_addr: pattr += this->dwinfo_->address_size(); break; + case elfcpp::DW_FORM_ref_addr: + pattr += this->dwinfo_->ref_addr_size(); + break; case elfcpp::DW_FORM_block1: pattr += 1 + *pattr; break; |