diff options
author | Cary Coutant <ccoutant@google.com> | 2013-07-01 20:12:11 +0000 |
---|---|---|
committer | Cary Coutant <ccoutant@google.com> | 2013-07-01 20:12:11 +0000 |
commit | 267257d249baacd6ca4452a02abcbc0ca62e4ba6 (patch) | |
tree | 3556c13f7ffe4a7780c2372fcedb2f7766af6bd1 /gold/dwarf_reader.cc | |
parent | 4db1a1dc03bd31b37724d9a6c07f1ee9fc4683f8 (diff) | |
download | gdb-267257d249baacd6ca4452a02abcbc0ca62e4ba6.zip gdb-267257d249baacd6ca4452a02abcbc0ca62e4ba6.tar.gz gdb-267257d249baacd6ca4452a02abcbc0ca62e4ba6.tar.bz2 |
gold/
* dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
reloc_type_.
(Dwarf_ranges_table::read_range_list): Call lookup_reloc.
(Dwarf_ranges_table::lookup_reloc): New function.
* dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
reloc_type_.
(Dwarf_ranges_table::lookup_reloc): New function.
(Dwarf_ranges_table::reloc_type_): New data member.
Diffstat (limited to 'gold/dwarf_reader.cc')
-rw-r--r-- | gold/dwarf_reader.cc | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/gold/dwarf_reader.cc b/gold/dwarf_reader.cc index 6b01b7f..4233954 100644 --- a/gold/dwarf_reader.cc +++ b/gold/dwarf_reader.cc @@ -374,6 +374,7 @@ Dwarf_ranges_table::read_ranges_table( this->ranges_reloc_mapper_ = make_elf_reloc_mapper(object, symtab, symtab_size); this->ranges_reloc_mapper_->initialize(reloc_shndx, reloc_type); + this->reloc_type_ = reloc_type; return true; } @@ -430,11 +431,8 @@ Dwarf_ranges_table::read_range_list( unsigned int shndx2 = 0; if (this->ranges_reloc_mapper_ != NULL) { - shndx1 = - this->ranges_reloc_mapper_->get_reloc_target(offset, &start); - shndx2 = - this->ranges_reloc_mapper_->get_reloc_target(offset + addr_size, - &end); + shndx1 = this->lookup_reloc(offset, &start); + shndx2 = this->lookup_reloc(offset + addr_size, &end); } // End of list is marked by a pair of zeroes. @@ -460,6 +458,24 @@ Dwarf_ranges_table::read_range_list( return ranges; } +// Look for a relocation at offset OFF in the range table, +// and return the section index and offset of the target. + +unsigned int +Dwarf_ranges_table::lookup_reloc(off_t off, off_t* target_off) +{ + off_t value; + unsigned int shndx = + this->ranges_reloc_mapper_->get_reloc_target(off, &value); + if (shndx == 0) + return 0; + if (this->reloc_type_ == elfcpp::SHT_REL) + *target_off += value; + else + *target_off = value; + return shndx; +} + // class Dwarf_pubnames_table // Read the pubnames section SHNDX from the object file. |