-Output_compressed_section_data::do_write(Output_file* of)
-{
- unsigned char* uview = of->get_output_view(this->offset(),
- this->data_size());
- char* view = reinterpret_cast<char*>(uview);
- memcpy(view, this->data_, this->data_size());
- of->write_output_view(this->offset(), this->data_size(), uview);
-}
-
-// Class Output_compressed_string.
-
-// Add an input section. We don't do anything special here.
-
-template<typename Char_type>
-bool
-Output_compressed_string<Char_type>::do_add_input_section(Relobj* object,
- unsigned int shndx)
-{
- return Output_merge_string<Char_type>::do_add_input_section(object, shndx);
-}
-
-// Set the final data size of a compressed section. This is where
-// we actually compress the section data.
-
-template<typename Char_type>
-void
-Output_compressed_string<Char_type>::set_final_data_size()
-{
- // First let the superclass finalize all its data, then write it to
- // a buffer.
- unsigned long uncompressed_size = this->finalize_merged_data();
- char* uncompressed_data = new char[uncompressed_size];
- this->stringpool_to_buffer(uncompressed_data, uncompressed_size);
-
- // (Try to) compress the data.
- unsigned long compressed_size;
- if (options_.zlib_compress_debug_sections()
- && zlib_compress(uncompressed_data, uncompressed_size,
- &this->compressed_data_, &compressed_size))
- {
- this->set_data_size(compressed_size);
- // Save some memory.
- this->clear_stringpool();
- // We will be renaming the section to name.zlib.uncompressed_size.
- this->new_section_name_ = zlib_compressed_suffix(uncompressed_size);
- }
- else
- {
- this->compressed_data_ = NULL;
- this->set_data_size(uncompressed_size);
- }
-
- delete[] uncompressed_data;
-}
-
-// Change the name of the output section to reflect it's compressed.
-// The layout routines call into this right before finalizing the
-// shstrtab.
-
-template<typename Char_type>
-const char*
-Output_compressed_string<Char_type>::do_modified_output_section_name(
- const char* name)
-{
- // This mean we never compressed the data
- if (this->new_section_name_.empty())
- return NULL;
- this->new_section_name_ = std::string(name) + this->new_section_name_;
- return this->new_section_name_.c_str();
-}
-
-// Write out a compressed string section. If we couldn't compress,
-// we just write out the normal string section.
-
-template<typename Char_type>
-void
-Output_compressed_string<Char_type>::do_write(Output_file* of)