aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2012-10-23 21:37:26 +0000
committerCary Coutant <ccoutant@google.com>2012-10-23 21:37:26 +0000
commit8787852de14e445e04bfb644c2c0d9178f807ec2 (patch)
tree64c307ba9581510cee0bc928712c13cf3b0067a5
parent9fc236f3fd33165d017dee94798ed08db95e87a0 (diff)
downloadgdb-8787852de14e445e04bfb644c2c0d9178f807ec2.zip
gdb-8787852de14e445e04bfb644c2c0d9178f807ec2.tar.gz
gdb-8787852de14e445e04bfb644c2c0d9178f807ec2.tar.bz2
gold/
* dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored abbrev_shndx. * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize abbrev_shndx_. (Dwarf_info_reader::set_abbrev_shndx): New method. (Dwarf_info_reader::abbrev_shndx_): New data member.
-rw-r--r--gold/ChangeLog9
-rw-r--r--gold/dwarf_reader.cc2
-rw-r--r--gold/dwarf_reader.h21
3 files changed, 25 insertions, 7 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index dbf1f5e..7c37dcb 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,5 +1,14 @@
2012-10-23 Cary Coutant <ccoutant@google.com>
+ * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
+ abbrev_shndx.
+ * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
+ abbrev_shndx_.
+ (Dwarf_info_reader::set_abbrev_shndx): New method.
+ (Dwarf_info_reader::abbrev_shndx_): New data member.
+
+2012-10-23 Cary Coutant <ccoutant@google.com>
+
* dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
from object, not parameters.
(Dwarf_info_reader::parse): Likewise.
diff --git a/gold/dwarf_reader.cc b/gold/dwarf_reader.cc
index d0f059d..14222c5 100644
--- a/gold/dwarf_reader.cc
+++ b/gold/dwarf_reader.cc
@@ -1195,7 +1195,7 @@ Dwarf_info_reader::do_parse()
this->reloc_mapper_->initialize(this->reloc_shndx_, this->reloc_type_);
// Loop over compilation units (or type units).
- unsigned int abbrev_shndx = 0;
+ unsigned int abbrev_shndx = this->abbrev_shndx_;
off_t abbrev_offset = 0;
const unsigned char* pinfo = this->buffer_;
while (pinfo < this->buffer_end_)
diff --git a/gold/dwarf_reader.h b/gold/dwarf_reader.h
index de5722b..aea63ab 100644
--- a/gold/dwarf_reader.h
+++ b/gold/dwarf_reader.h
@@ -662,12 +662,12 @@ class Dwarf_info_reader
unsigned int reloc_type)
: is_type_unit_(is_type_unit), object_(object), symtab_(symtab),
symtab_size_(symtab_size), shndx_(shndx), reloc_shndx_(reloc_shndx),
- reloc_type_(reloc_type), string_shndx_(0), buffer_(NULL),
- buffer_end_(NULL), cu_offset_(0), cu_length_(0), offset_size_(0),
- address_size_(0), cu_version_(0), type_signature_(0), type_offset_(0),
- abbrev_table_(), reloc_mapper_(NULL), string_buffer_(NULL),
- string_buffer_end_(NULL), owns_string_buffer_(false),
- string_output_section_offset_(0)
+ reloc_type_(reloc_type), abbrev_shndx_(0), string_shndx_(0),
+ buffer_(NULL), buffer_end_(NULL), cu_offset_(0), cu_length_(0),
+ offset_size_(0), address_size_(0), cu_version_(0), type_signature_(0),
+ type_offset_(0), abbrev_table_(), reloc_mapper_(NULL),
+ string_buffer_(NULL), string_buffer_end_(NULL),
+ owns_string_buffer_(false), string_output_section_offset_(0)
{ }
virtual
@@ -719,6 +719,13 @@ class Dwarf_info_reader
address_size() const
{ return 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.
+ void
+ set_abbrev_shndx(unsigned int abbrev_shndx)
+ { this->abbrev_shndx_ = abbrev_shndx; }
+
protected:
// Begin parsing the debug info. This calls visit_compilation_unit()
// or visit_type_unit() for each compilation or type unit found in the
@@ -811,6 +818,8 @@ class Dwarf_info_reader
unsigned int reloc_shndx_;
// Type of the relocation section (SHT_REL or SHT_RELA).
unsigned int reloc_type_;
+ // Index of the .debug_abbrev section (0 if not known).
+ unsigned int abbrev_shndx_;
// Index of the .debug_str section.
unsigned int string_shndx_;
// The buffer for the debug info.