aboutsummaryrefslogtreecommitdiff
path: root/gold/object.h
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2010-07-12 17:59:58 +0000
committerCary Coutant <ccoutant@google.com>2010-07-12 17:59:58 +0000
commita2e4736229d6ce6f804ed26ea8d763c538de9d2c (patch)
tree25de3c95f1bf545500aa9adf3278422f477ace18 /gold/object.h
parentadd265ae415ecd40208537d1f84155f868668ef5 (diff)
downloadgdb-a2e4736229d6ce6f804ed26ea8d763c538de9d2c.zip
gdb-a2e4736229d6ce6f804ed26ea8d763c538de9d2c.tar.gz
gdb-a2e4736229d6ce6f804ed26ea8d763c538de9d2c.tar.bz2
* 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.
Diffstat (limited to 'gold/object.h')
-rw-r--r--gold/object.h40
1 files changed, 39 insertions, 1 deletions
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<Symbol*> vec_;
};
+// Type for mapping section index to uncompressed size.
+
+typedef std::map<unsigned int, section_size_type> Compressed_section_map;
+
// A regular object file. This is size and endian specific.
template<int size, bool big_endian>
@@ -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<size, big_endian> This;
@@ -2024,6 +2060,8 @@ class Sized_relobj : public Relobj
std::vector<Deferred_layout> deferred_layout_;
// The list of relocation sections whose layout was deferred.
std::vector<Deferred_layout> 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.