mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-07-27 03:42:56 +08:00
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.
This commit is contained in:
@ -1,3 +1,14 @@
|
|||||||
|
2013-07-01 Cary Coutant <ccoutant@google.com>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2013-06-27 Jing Yu <jingyu@google.com>
|
2013-06-27 Jing Yu <jingyu@google.com>
|
||||||
|
|
||||||
PR gold/15662
|
PR gold/15662
|
||||||
|
@ -374,6 +374,7 @@ Dwarf_ranges_table::read_ranges_table(
|
|||||||
this->ranges_reloc_mapper_ = make_elf_reloc_mapper(object, symtab,
|
this->ranges_reloc_mapper_ = make_elf_reloc_mapper(object, symtab,
|
||||||
symtab_size);
|
symtab_size);
|
||||||
this->ranges_reloc_mapper_->initialize(reloc_shndx, reloc_type);
|
this->ranges_reloc_mapper_->initialize(reloc_shndx, reloc_type);
|
||||||
|
this->reloc_type_ = reloc_type;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -430,11 +431,8 @@ Dwarf_ranges_table::read_range_list(
|
|||||||
unsigned int shndx2 = 0;
|
unsigned int shndx2 = 0;
|
||||||
if (this->ranges_reloc_mapper_ != NULL)
|
if (this->ranges_reloc_mapper_ != NULL)
|
||||||
{
|
{
|
||||||
shndx1 =
|
shndx1 = this->lookup_reloc(offset, &start);
|
||||||
this->ranges_reloc_mapper_->get_reloc_target(offset, &start);
|
shndx2 = this->lookup_reloc(offset + addr_size, &end);
|
||||||
shndx2 =
|
|
||||||
this->ranges_reloc_mapper_->get_reloc_target(offset + addr_size,
|
|
||||||
&end);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// End of list is marked by a pair of zeroes.
|
// End of list is marked by a pair of zeroes.
|
||||||
@ -460,6 +458,24 @@ Dwarf_ranges_table::read_range_list(
|
|||||||
return ranges;
|
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
|
// class Dwarf_pubnames_table
|
||||||
|
|
||||||
// Read the pubnames section SHNDX from the object file.
|
// Read the pubnames section SHNDX from the object file.
|
||||||
|
@ -338,7 +338,7 @@ class Dwarf_ranges_table
|
|||||||
Dwarf_ranges_table(Dwarf_info_reader* dwinfo)
|
Dwarf_ranges_table(Dwarf_info_reader* dwinfo)
|
||||||
: dwinfo_(dwinfo), ranges_shndx_(0), ranges_buffer_(NULL),
|
: dwinfo_(dwinfo), ranges_shndx_(0), ranges_buffer_(NULL),
|
||||||
ranges_buffer_end_(NULL), owns_ranges_buffer_(false),
|
ranges_buffer_end_(NULL), owns_ranges_buffer_(false),
|
||||||
ranges_reloc_mapper_(NULL), output_section_offset_(0)
|
ranges_reloc_mapper_(NULL), reloc_type_(0), output_section_offset_(0)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
~Dwarf_ranges_table()
|
~Dwarf_ranges_table()
|
||||||
@ -365,6 +365,11 @@ class Dwarf_ranges_table
|
|||||||
unsigned int ranges_shndx,
|
unsigned int ranges_shndx,
|
||||||
off_t ranges_offset);
|
off_t ranges_offset);
|
||||||
|
|
||||||
|
// Look for a relocation at offset OFF in the range table,
|
||||||
|
// and return the section index and offset of the target.
|
||||||
|
unsigned int
|
||||||
|
lookup_reloc(off_t off, off_t* target_off);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// The Dwarf_info_reader, for reading data.
|
// The Dwarf_info_reader, for reading data.
|
||||||
Dwarf_info_reader* dwinfo_;
|
Dwarf_info_reader* dwinfo_;
|
||||||
@ -377,6 +382,8 @@ class Dwarf_ranges_table
|
|||||||
bool owns_ranges_buffer_;
|
bool owns_ranges_buffer_;
|
||||||
// Relocation mapper for the .debug_ranges section.
|
// Relocation mapper for the .debug_ranges section.
|
||||||
Elf_reloc_mapper* ranges_reloc_mapper_;
|
Elf_reloc_mapper* ranges_reloc_mapper_;
|
||||||
|
// Type of the relocation section (SHT_REL or SHT_RELA).
|
||||||
|
unsigned int reloc_type_;
|
||||||
// For incremental update links, this will hold the offset of the
|
// For incremental update links, this will hold the offset of the
|
||||||
// input section within the output section. Offsets read from
|
// input section within the output section. Offsets read from
|
||||||
// relocated data will be relative to the output section, and need
|
// relocated data will be relative to the output section, and need
|
||||||
|
Reference in New Issue
Block a user