diff options
author | Cary Coutant <ccoutant@google.com> | 2010-07-12 17:59:58 +0000 |
---|---|---|
committer | Cary Coutant <ccoutant@google.com> | 2010-07-12 17:59:58 +0000 |
commit | a2e4736229d6ce6f804ed26ea8d763c538de9d2c (patch) | |
tree | 25de3c95f1bf545500aa9adf3278422f477ace18 /gold/layout.cc | |
parent | add265ae415ecd40208537d1f84155f868668ef5 (diff) | |
download | gdb-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/layout.cc')
-rw-r--r-- | gold/layout.cc | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/gold/layout.cc b/gold/layout.cc index 9310961..b22a3bd 100644 --- a/gold/layout.cc +++ b/gold/layout.cc @@ -944,7 +944,16 @@ Layout::section_flags_to_segment(elfcpp::Elf_Xword flags) static bool is_compressible_debug_section(const char* secname) { - return (strncmp(secname, ".debug", sizeof(".debug") - 1) == 0); + return (is_prefix_of(".debug", secname)); +} + +// 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 (is_prefix_of(".zdebug", secname)); } // Make a new Output_section, and attach it to segments as @@ -3772,6 +3781,20 @@ Layout::output_section_name(const char* name, size_t* plen) } } + // Compressed debug sections should be mapped to the corresponding + // uncompressed section. + if (is_compressed_debug_section(name)) + { + size_t len = strlen(name); + char *uncompressed_name = new char[len]; + uncompressed_name[0] = '.'; + gold_assert(name[0] == '.' && name[1] == 'z'); + strncpy(&uncompressed_name[1], &name[2], len - 2); + uncompressed_name[len - 1] = '\0'; + *plen = len - 1; + return uncompressed_name; + } + return name; } |