From a2e4736229d6ce6f804ed26ea8d763c538de9d2c Mon Sep 17 00:00:00 2001 From: Cary Coutant Date: Mon, 12 Jul 2010 17:59:58 +0000 Subject: * compressed_output.cc (zlib_decompress): New function. (get_uncompressed_size): New function. (decompress_input_section): New function. * compressed_output.h (get_uncompressed_size): New function. (decompress_input_section): New function. * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info) Handle compressed debug sections. * layout.cc (is_compressed_debug_section): New function. (Layout::output_section_name): Map compressed section names to canonical names. * layout.h (is_compressed_debug_section): New function. (is_debug_info_section): Recognize compressed debug sections. * merge.cc: Include compressed_output.h. (Output_merge_data::do_add_input_section): Handle compressed debug sections. (Output_merge_string::do_add_input_section): Handle compressed debug sections. * object.cc: Include compressed_output.h. (Sized_relobj::Sized_relobj): Initialize new data members. (build_compressed_section_map): New function. (Sized_relobj::do_read_symbols): Handle compressed debug sections. * object.h (Object::section_is_compressed): New method. (Object::do_section_is_compressed): New method. (Sized_relobj::Compressed_section_map): New type. (Sized_relobj::do_section_is_compressed): New method. (Sized_relobj::compressed_sections_): New data member. * output.cc (Output_section::add_input_section): Handle compressed debug sections. * reloc.cc: Include compressed_output.h. (Sized_relobj::write_sections): Handle compressed debug sections. --- gold/object.h | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'gold/object.h') diff --git a/gold/object.h b/gold/object.h index bc2b558..f60d909 100644 --- a/gold/object.h +++ b/gold/object.h @@ -518,6 +518,13 @@ class Object set_no_export(bool value) { this->no_export_ = value; } + // Return TRUE if the section is a compressed debug section, and set + // *UNCOMPRESSED_SIZE to the size of the uncompressed data. + bool + section_is_compressed(unsigned int shndx, + section_size_type* uncompressed_size) const + { return this->do_section_is_compressed(shndx, uncompressed_size); } + protected: // Returns NULL for Objects that are not plugin objects. This method // is overridden in the Pluginobj class. @@ -628,6 +635,12 @@ class Object bool handle_split_stack_section(const char* name); + // Return TRUE if the section is a compressed debug section, and set + // *UNCOMPRESSED_SIZE to the size of the uncompressed data. + virtual bool + do_section_is_compressed(unsigned int, section_size_type*) const + { return false; } + private: // This class may not be copied. Object(const Object&); @@ -1406,6 +1419,10 @@ class Reloc_symbol_changes std::vector vec_; }; +// Type for mapping section index to uncompressed size. + +typedef std::map Compressed_section_map; + // A regular object file. This is size and endian specific. template @@ -1781,7 +1798,26 @@ class Sized_relobj : public Relobj void set_output_local_symbol_count(unsigned int value) { this->output_local_symbol_count_ = value; } - + + // Return TRUE if the section is a compressed debug section, and set + // *UNCOMPRESSED_SIZE to the size of the uncompressed data. + bool + do_section_is_compressed(unsigned int shndx, + section_size_type* uncompressed_size) const + { + if (this->compressed_sections_ == NULL) + return false; + Compressed_section_map::const_iterator p = + this->compressed_sections_->find(shndx); + if (p != this->compressed_sections_->end()) + { + if (uncompressed_size != NULL) + *uncompressed_size = p->second; + return true; + } + return false; + } + private: // For convenience. typedef Sized_relobj This; @@ -2024,6 +2060,8 @@ class Sized_relobj : public Relobj std::vector deferred_layout_; // The list of relocation sections whose layout was deferred. std::vector deferred_layout_relocs_; + // For compressed debug sections, map section index to uncompressed size. + Compressed_section_map* compressed_sections_; }; // A class to manage the list of all objects. -- cgit v1.1