[gold][patch] Add support for reading compressed debug sections
Ian Lance Taylor
iant@google.com
Mon Jul 12 10:46:00 GMT 2010
Cary Coutant <ccoutant@google.com> writes:
> * 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.
> +// We may see compressed debug sections in input files. Return TRUE
> +// if this is the name of a compressed debug section.
> +
> +bool
> +is_compressed_debug_section(const char* secname)
> +{
> + return (strncmp(secname, ".zdebug", sizeof(".zdebug") - 1) == 0);
> +}
Write this as
return is_prefix_of(".zdebug", secname);
> + // TODO: Remove debug printf.
> + printf("%s: compressed section [%d] %s: %lld -> %lld\n",
> + obj->name().c_str(), i, name,
> + static_cast<long long>(len),
> + static_cast<long long>(uncompressed_size));
This one still needs to go.
> + // 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 do_section_is_compressed(shndx, uncompressed_size); }
Use this->do_section_is_compressed.
This is OK with those changes.
Thanks.
Ian
More information about the Binutils
mailing list