summaryrefslogtreecommitdiff
path: root/gold/dynobj.cc
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@gmail.com>2015-03-21 18:50:11 -0700
committerCary Coutant <ccoutant@gmail.com>2015-03-21 18:50:11 -0700
commit0d5bbdb0e1d193fa6f6804f2620fbdfc950c57a4 (patch)
treebc1a6af5c95feab95cd27d56c97dd0c61bb05939 /gold/dynobj.cc
parentbd9e0d4628f1265c42516f90c4f162cefa787294 (diff)
downloadbinutils-gdb-0d5bbdb0e1d193fa6f6804f2620fbdfc950c57a4.tar.gz
Support compressed debug sections in dynamic object files.
This patch adds support for reading compressed debug info in shared objects. It actually simplifies things, by moving the support for compressed sections all the way up to the top-level Object class, eliminating the need for several virtual methods. gold/ * dwp.cc (Sized_relobj_dwo::do_section_contents): Delete. (Sized_relobj_dwo::setup): Build compressed section map. (Sized_relobj_dwo::do_decompressed_section_contents): Delete. * dynobj.cc (Sized_dynobj::base_read_symbols): Build compressed section map. * object.cc (Sized_relobj_file::Sized_relobj_file): Remove compressed_sections_ field. (build_compressed_section_map): Take Object instead of Sized_relobj_file parameter; add decompress_if_needed parameter. (Sized_relobj_file::do_find_special_sections): Store compressed section map in parent Object. (Sized_relobj_file::do_decompressed_section_contents): Move implementation to Object::decompressed_section_contents. (Sized_relobj_file::do_discard_decompressed_sections): Move implementation to Object::discard_decompressed_sections. * object.h (build_compressed_section_map): Declare. (Object::Object): Add compressed_sections_ field. (Object::section_is_compressed): Move implementation here. (Object::decompressed_section_contents): De-virtualize. (Object::discard_decompressed_sections): De-virtualize. (Object::do_section_is_compressed): Delete. (Object::do_decompressed_section_contents): Delete. (Object::set_compressed_sections): New method. (Object::compressed_sections): New method. (Object::compressed_sections_): New data member. (Compressed_section_info, Compressed_section_map): Move to top of file. (Sized_relobj_file::do_section_is_compressed): Delete. (Sized_relobj_file::do_decompressed_section_contents): Delete. (Sized_relobj_file::do_discard_decompressed_sections): Delete. (Sized_relobj_file::compressed_sections_): Move to Object class.
Diffstat (limited to 'gold/dynobj.cc')
-rw-r--r--gold/dynobj.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/gold/dynobj.cc b/gold/dynobj.cc
index 8bf6251f74b..13e3f616a60 100644
--- a/gold/dynobj.cc
+++ b/gold/dynobj.cc
@@ -374,6 +374,17 @@ Sized_dynobj<size, big_endian>::base_read_symbols(Read_symbols_data* sd)
sd->verneed_size = 0;
sd->verneed_info = 0;
+ const unsigned char* namesu = sd->section_names->data();
+ const char* names = reinterpret_cast<const char*>(namesu);
+ if (memmem(names, sd->section_names_size, ".zdebug_", 8) != NULL)
+ {
+ Compressed_section_map* compressed_sections =
+ build_compressed_section_map<size, big_endian>(
+ pshdrs, this->shnum(), names, sd->section_names_size, this, true);
+ if (compressed_sections != NULL)
+ this->set_compressed_sections(compressed_sections);
+ }
+
if (this->dynsym_shndx_ != -1U)
{
// Get the dynamic symbols.