summaryrefslogtreecommitdiff
path: root/gold/dwarf_reader.cc
AgeCommit message (Collapse)Author
2018-01-03Update year range in copyright notice of binutils filesAlan Modra
2017-11-19Fix DWARF reader to use correct size for DW_FORM_ref_addr.Cary Coutant
2017-11-19 Ian Lance Taylor <iant@google.com> Cary Coutant <ccoutant@gmail.com> gold/ * gold/dwarf_reader.h (class Dwarf_info_reader): Add ref_addr_size method. * gold/dwarf_reader.cc (Dwarf_die::read_attributes): Use ref_addr_size for DW_FORM_ref_addr_size. (Dwarf_die::skip_attributes): Likewise.
2017-01-02Update year range in copyright notice of all files.Alan Modra
2016-01-01Copyright update for binutilsAlan Modra
2015-04-09Improve ODR checking in gold.Cary Coutant
gold/ * debug.h (DEBUG_LOCATION): New. (DEBUG_ALL): Include DEBUG_LOCATION. (debug_string_to_enum): Add DEBUG_LOCATION. * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Fix debug output to print correct context. (Sized_dwarf_line_info::do_addr2line): Add debug output. Return up to 4 more locations at the beginning of the function. * symtab.cc (Symbol_table::detect_odr_violations): Get canonical result before sorting list of line numbers. * testsuite/debug_msg.sh: Allow range of line numbers for canonical results on optimized code.
2015-01-02ChangeLog rotatation and copyright year updateAlan Modra
2014-06-09Add check to keep from segfaulting on a corrupt .debug_pubnames section.Cary Coutant
gold/ * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that unit_length is within section bounds.
2014-06-06Strip .debug_gnu_pubnames and .debug_gnu_pubtypes when building .gdb_index.Cary Coutant
When not stripping those sections, there was a bug where gold was incorrectly adjusting section-relative offsets by the offset of the input section within the output section. That adjustment was both unnecessary and wrong, causing gold to miss a number of debug entries that should have been added to .gdb_index. (With stripping, the adjustment was always 0, so the bug in dwarf_reader.cc would have been hidden by the change to layout.cc.) gold/ * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_. * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise. (Dwarf_pubnames_table::read_header): Likewise. * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and .debug_gnu_pubtypes.
2014-03-05Update copyright yearsAlan Modra
2014-01-28Add .gdb_index version 7 support.Cary Coutant
This patch adds support for .gdb_index version 7, which adds several flag bits to the symbol index. It also fixes a problem where it did not handle compressed debug sections correctly. Tested with a google/gcc-4_8 branch compiler, which supports the -ggnu-pubnames option to generate .debug_gnu_pubnames/pubtypes tables. (We will submit that patch to GCC when stage 1 reopens.) 2014-01-28 Cary Coutant <ccoutant@google.com> * gold/dwarf_reader.cc: include <utility> (for make_pair). (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed debug sections. (Dwarf_ranges_table::read_ranges_table): Likewise. (Dwarf_pubnames_table::read_section): Check for GNU-style sections, and for compressed debug sections. (Dwarf_pubnames_table::read_header): Compute end address of table. (Dwarf_pubnames_table::next_name): Return flag_byte. Check for end of list by offset, not by offset == 0. (Dwarf_info_reader::do_read_string_table): Check for compressed debug sections. * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table): Initialize new data members. (Dwarf_pubnames_table::next_name): return flag_byte. (Dwarf_pubnames_table::end_of_table_): New data member. (Dwarf_pubnames_table::is_gnu_style_): New data member. * gold/gdb-index.cc (gdb_index_version): Update to version 7. (Gdb_index_info_reader::read_pubtable): Read flag_byte. (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't read skeleton type unit DIEs. (Gdb_index::add_symbol): Add flag_byte; adjust all callers. (Gdb_index::do_write): Write flag_byte. * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter. (Gdb_index::Cu_vector): Store flags along with cu indexes. * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7. * gold/testsuite/gdb_index_test_comm.sh: Likewise.
2013-10-31Restore support for dwp v2 DWARF package file format.Cary Coutant
gold/ * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add tu_length parameter. Adjust all callers. * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise. * dwp.cc: Include dwarf.h. (Section_bounds): New struct type. (Unit_set): New struct type. (Dwo_file::Dwo_file): Initialize new data member. (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index): Combine and rename to... (Dwo_file::read_unit_index): ...this. (Dwo_file::sized_read_compunit_index) (Dwo_file::sized_read_typeunit_index): Combine and rename to... (Dwo_file::sized_read_unit_index): ...this. (Dwo_file::copy_section): Remove section_name, is_str_offsets parameters; add section_id parameter. (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to... (Dwo_file::add_unit_set): ...this. (Dwo_file::shndx_map_): Remove. (Dwo_file::sect_offsets_): New data member. (Dwp_output_file::Dwp_output_file): Initialize new data members. (Dwp_output_file::add_section): Rename to... (Dwp_output_file::add_contribution): ...this. (Dwp_output_file::add_cu_set): Combine parameters into a struct. (Dwp_output_file::add_tu_set): Likewise. (Dwp_output_file::Contribution): New type. (Dwp_output_file::Section::contributions): New data member. (Dwp_output_file::Cu_or_tu_set): Remove. (Dwp_output_file::Section::Section): New ctor. (Dwp_output_file::Dwp_index::Shndx_pool): Remove. (Dwp_output_file::Dwp_index::Section_table): New type. (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members. (Dwp_output_file::Dwp_index::enter_set): Change type of "set" parameter. (Dwp_output_file::Dwp_index::shndx_pool): Remove. (Dwp_output_file::Dwp_index::shndx_pool_end): Remove. (Dwp_output_file::Dwp_index::section_table): New member function. (Dwp_output_file::Dwp_index::section_table_end): New member function. (Dwp_output_file::Dwp_index::shndx_pool_size): Remove. (Dwp_output_file::Dwp_index::section_table_rows): New member function. (Dwp_output_file::Dwp_index::section_table_cols): New member function. (Dwp_output_file::Dwp_index::shndx_pool_): Remove. (Dwp_output_file::Dwp_index::section_table_): New data member. (Dwp_output_file::Dwp_index::section_mask_): New data member. (Dwp_output_file::add_output_section): New member function. (Dwp_output_file::write_new_section): New member function. (Dwp_output_file::write_contributions): New member function. (Dwp_output_file::section_id_map_): New data member. (class Dwo_id_info_reader): Remove. (class Unit_reader): New class. (get_dwarf_section_name): New function. (Dwo_file::read_executable): Adjust initializations of class data. (Dwo_file::read): Add support for v2 package file format. (Dwo_file::read_unit_index): Likewise. (Dwo_file::sized_read_unit_index): Likewise. (Dwo_file::copy_section): Likewise. (Dwo_file::add_unit_set): Likewise. (Dwp_output_file::add_output_section): Likewise. (Dwp_output_file::add_contribution): Likewise. (Dwp_output_file::Dwp_index::find_or_add): Use row index to check for empty slot. (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package file format. (Dwp_output_file::Dwp_index::grow): Use row index to check for empty slot. (Dwp_output_file::initialize): Remove unused function. (Dwp_output_file::finalize): Add support for v2 package file format. (Dwp_output_file::write_index): Likewise. * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust function prototype.
2013-08-07gold/Cary Coutant
Revert support for v2 DWP files: 2013-03-01 Cary Coutant <ccoutant@google.com> Add dwp support for v2 DWARF package file format. * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add tu_length parameter. Adjust all callers. * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise. * dwp.cc: Include dwarf.h. (Section_bounds): New struct type. (Unit_set): New struct type. (Dwo_file::Dwo_file): Initialize new data member. (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index): Combine and rename to... (Dwo_file::read_unit_index): ...this. (Dwo_file::sized_read_compunit_index) (Dwo_file::sized_read_typeunit_index): Combine and rename to... (Dwo_file::sized_read_unit_index): ...this. (Dwo_file::copy_section): Remove section_name, is_str_offsets parameters; add section_id parameter. (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to... (Dwo_file::add_unit_set): ...this. (Dwo_file::shndx_map_): Remove. (Dwo_file::sect_offsets_): New data member. (Dwp_output_file::Dwp_output_file): Initialize new data members. (Dwp_output_file::add_section): Rename to... (Dwp_output_file::add_contribution): ...this. (Dwp_output_file::add_cu_set): Combine parameters into a struct. (Dwp_output_file::add_tu_set): Likewise. (Dwp_output_file::Contribution): New type. (Dwp_output_file::Section::contributions): New data member. (Dwp_output_file::Cu_or_tu_set): Remove. (Dwp_output_file::Section::Section): New ctor. (Dwp_output_file::Dwp_index::Shndx_pool): Remove. (Dwp_output_file::Dwp_index::Section_table): New type. (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members. (Dwp_output_file::Dwp_index::enter_set): Change type of "set" parameter. (Dwp_output_file::Dwp_index::shndx_pool): Remove. (Dwp_output_file::Dwp_index::shndx_pool_end): Remove. (Dwp_output_file::Dwp_index::section_table): New member function. (Dwp_output_file::Dwp_index::section_table_end): New member function. (Dwp_output_file::Dwp_index::shndx_pool_size): Remove. (Dwp_output_file::Dwp_index::section_table_rows): New member function. (Dwp_output_file::Dwp_index::section_table_cols): New member function. (Dwp_output_file::Dwp_index::shndx_pool_): Remove. (Dwp_output_file::Dwp_index::section_table_): New data member. (Dwp_output_file::Dwp_index::section_mask_): New data member. (Dwp_output_file::add_output_section): New member function. (Dwp_output_file::write_new_section): New member function. (Dwp_output_file::write_contributions): New member function. (Dwp_output_file::section_id_map_): New data member. (class Dwo_id_info_reader): Remove. (class Unit_reader): New class. (get_dwarf_section_name): New function. (Dwo_file::read_executable): Adjust initializations of class data. (Dwo_file::read): Add support for v2 package file format. (Dwo_file::read_unit_index): Likewise. (Dwo_file::sized_read_unit_index): Likewise. (Dwo_file::copy_section): Likewise. (Dwo_file::add_unit_set): Likewise. (Dwp_output_file::add_output_section): Likewise. (Dwp_output_file::add_contribution): Likewise. (Dwp_output_file::Dwp_index::find_or_add): Use row index to check for empty slot. (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package file format. (Dwp_output_file::Dwp_index::grow): Use row index to check for empty slot. (Dwp_output_file::initialize): Remove unused function. (Dwp_output_file::finalize): Add support for v2 package file format. (Dwp_output_file::write_index): Likewise. * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust function prototype.
2013-07-292013-07-22 Sterling Augustine <saugustine@google.com>Sterling Augustine
* dwarf_reader.cc (Dwarf_pubnames_table::read_section): Convert parameter shndx to local variable. Add parameters symtab and symtab_size. Scan over section names. Find relocation section corresponding to current section. Create and initialize reloc_mapper_ and reloc_type_. (Dwarf_pubnames_table::read_header): Add assertion. Change unit_length to off_t. Initialize member unit_length_. Fill in field cu_offset_. * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table): Initialize new fields unit_length_ and cu_offset_. (Dwarf_pubnames_table::read_section): Update prototype. (Dwarf_pubnames_table::cu_offset): New member function. (Dwarf_pubnames_table::subsection_size): Likewise. (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length): New fields. (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make member functions public. * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes): Update comment. Rework logic. Move repeated parts to... (Gdb_index_info_reader::read_pubtable): ...here. New function. (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_, pubtypes_table_, and stmt_list_offset. (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset, Gdb_index::find_pubtype_offset, Gdb_index::map_pubnames_and_types_to_dies): Define new functions. (Gdb_index::pubnames_read): Update prototype and rework logic. * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table): Forward declare. (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset, Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table) Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies, Gdb_index::map_pubtable_to_dies): Declare functions. (Gdb_index::pubnames_read): Update declaration. (Gdb_index::Pubname_offset_map): New type. (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_, Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_, Gdb_index::stmt_list_offset): Declare. (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_, Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_) Gdb_index::pubtypes_offset_): Remove.
2013-07-01gold/Cary Coutant
* dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save reloc_type_. (Dwarf_ranges_table::read_range_list): Call lookup_reloc. (Dwarf_ranges_table::lookup_reloc): New function. * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize reloc_type_. (Dwarf_ranges_table::lookup_reloc): New function. (Dwarf_ranges_table::reloc_type_): New data member.
2013-03-01Add dwp support for v2 DWARF package file format.Cary Coutant
gold/ * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add tu_length parameter. Adjust all callers. * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise. * dwp.cc: Include dwarf.h. (Section_bounds): New struct type. (Unit_set): New struct type. (Dwo_file::Dwo_file): Initialize new data member. (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index): Combine and rename to... (Dwo_file::read_unit_index): ...this. (Dwo_file::sized_read_compunit_index) (Dwo_file::sized_read_typeunit_index): Combine and rename to... (Dwo_file::sized_read_unit_index): ...this. (Dwo_file::copy_section): Remove section_name, is_str_offsets parameters; add section_id parameter. (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to... (Dwo_file::add_unit_set): ...this. (Dwo_file::shndx_map_): Remove. (Dwo_file::sect_offsets_): New data member. (Dwp_output_file::Dwp_output_file): Initialize new data members. (Dwp_output_file::add_section): Rename to... (Dwp_output_file::add_contribution): ...this. (Dwp_output_file::add_cu_set): Combine parameters into a struct. (Dwp_output_file::add_tu_set): Likewise. (Dwp_output_file::Contribution): New type. (Dwp_output_file::Section::contributions): New data member. (Dwp_output_file::Cu_or_tu_set): Remove. (Dwp_output_file::Section::Section): New ctor. (Dwp_output_file::Dwp_index::Shndx_pool): Remove. (Dwp_output_file::Dwp_index::Section_table): New type. (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members. (Dwp_output_file::Dwp_index::enter_set): Change type of "set" parameter. (Dwp_output_file::Dwp_index::shndx_pool): Remove. (Dwp_output_file::Dwp_index::shndx_pool_end): Remove. (Dwp_output_file::Dwp_index::section_table): New member function. (Dwp_output_file::Dwp_index::section_table_end): New member function. (Dwp_output_file::Dwp_index::shndx_pool_size): Remove. (Dwp_output_file::Dwp_index::section_table_rows): New member function. (Dwp_output_file::Dwp_index::section_table_cols): New member function. (Dwp_output_file::Dwp_index::shndx_pool_): Remove. (Dwp_output_file::Dwp_index::section_table_): New data member. (Dwp_output_file::Dwp_index::section_mask_): New data member. (Dwp_output_file::add_output_section): New member function. (Dwp_output_file::write_new_section): New member function. (Dwp_output_file::write_contributions): New member function. (Dwp_output_file::section_id_map_): New data member. (class Dwo_id_info_reader): Remove. (class Unit_reader): New class. (get_dwarf_section_name): New function. (Dwo_file::read_executable): Adjust initializations of class data. (Dwo_file::read): Add support for v2 package file format. (Dwo_file::read_unit_index): Likewise. (Dwo_file::sized_read_unit_index): Likewise. (Dwo_file::copy_section): Likewise. (Dwo_file::add_unit_set): Likewise. (Dwp_output_file::add_output_section): Likewise. (Dwp_output_file::add_contribution): Likewise. (Dwp_output_file::Dwp_index::find_or_add): Use row index to check for empty slot. (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package file format. (Dwp_output_file::Dwp_index::grow): Use row index to check for empty slot. (Dwp_output_file::initialize): Remove unused function. (Dwp_output_file::finalize): Add support for v2 package file format. (Dwp_output_file::write_index): Likewise. * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust function prototype.
2013-03-01gold/Cary Coutant
* dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move function into class definition in header file. (Dwarf_info_reader::warn_corrupt_debug_section): New function. * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section): New function. (Dwarf_info_reader::check_buffer): Move here from .cc file.
2012-11-01gold/Roland McGrath
* dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast SYMNDX to off_t before comparing it to this->data_size(). * output.cc (Output_symtab_xindex::endian_do_write): Likewise. * incremental.cc (Output_section_incremental_inputs::do_write): Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
2012-10-23gold/Cary Coutant
* dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call Dwarf_info_reader::read_from_pointer. (Dwarf_pubnames_table::read_header): Likewise. (Dwarf_pubnames_table::next_name): Likewise. (Dwarf_die::read_attributes): Likewise. (Dwarf_die::skip_attributes): Likewise. (Dwarf_info_reader::read_from_pointer): New function template. * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_. (Dwarf_pubnames_table): Likewise. (Dwarf_info_reader::read_from_pointer): New function template. * gdb-index.cc (Gdb_index_info_reader): Adjust call to Dwarf_pubnames_table ctor.
2012-10-23gold/Cary Coutant
* dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored abbrev_shndx. * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize abbrev_shndx_. (Dwarf_info_reader::set_abbrev_shndx): New method. (Dwarf_info_reader::abbrev_shndx_): New data member.
2012-10-23gold/Cary Coutant
* dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness from object, not parameters. (Dwarf_info_reader::parse): Likewise. * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods. (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods. (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New methods.
2012-09-072012-09-06 Cary Coutant <ccoutant@google.com>Cary Coutant
gold/ * dwarf_reader.cc (Dwarf_die::read_attributes): Add DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index. (Dwarf_die::skip_attributes): Likewise. * object.cc (Read_symbols_data::~Read_symbols_data): Update comment. * testsuite/gdb_index_test.cc (inline_func_1): New function. (main): Call it. * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2012-07-11 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.Ian Lance Taylor
(Arm_exidx_cantunwind::do_fixed_endian_write): Likewise. (Target_arm::scan_reloc_for_stub): Likewise. * common.cc (Symbol_table::do_allocate_commons_list): Likewise. * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise. * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise. * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise. * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2012-05-01elfcpp/Cary Coutant
* dwarf.h (enum DW_TAG, enum DW_FORM, enum DW_AT, enum DW_ENCODING) (enum DW_OP, enum DW_CFA): Remove. Include dwarf2.def. gold/ * dwarf_reader.cc (Dwarf_die::read_attributes) (Dwarf_die::skip_attributes, Dwarf_die::int_attribute) (Dwarf_die::uint_attribute): Remove DW_FORM_null. * reduced_debug_output.cc (Output_reduced_debug_info_section::get_die_end): Remove DW_FORM_GNU_ref_index. Add default case.
2012-05-01gold: Handle DW_AT_high_pc as offset from DW_AT_low_pc in gdb-index.cc.Mark Wielaard
* dwarf_reader.cc (Dwarf_die::address_attribute): New function. * dwarf_reader.h (Dwarf_die::address_attribute): Likewise. * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle DW_AT_high_pc as offset from DW_AT_low_pc. * testsuite/Makefile.am (gdb_index_test_3.sh): New test case. * testsuite/Makefile.in: Regenerate. * testsuite/gdb_index_test_3.c: New test source file. * testsuite/gdb_index_test_3.sh: New test source file.
2012-03-212012-03-21 Cary Coutant <ccoutant@google.com>Cary Coutant
* Makefile.am: Add gdb-index.cc, gdb-index.h. * Makefile.in: Regenerate. * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function. (Sized_elf_reloc_mapper::symbol_section): New function. (Sized_elf_reloc_mapper::do_get_reloc_target): New function. (make_elf_reloc_mapper): New function. (Dwarf_abbrev_table::clear_abbrev_codes): New function. (Dwarf_abbrev_table::do_read_abbrevs): New function. (Dwarf_abbrev_table::do_get_abbrev): New function. (Dwarf_ranges_table::read_ranges_table): New function. (Dwarf_ranges_table::read_range_list): New function. (Dwarf_pubnames_table::read_section): New function. (Dwarf_pubnames_table::read_header): New function. (Dwarf_pubnames_table::next_name): New function. (Dwarf_die::Dwarf_die): New function. (Dwarf_die::read_attributes): New function. (Dwarf_die::skip_attributes): New function. (Dwarf_die::set_name): New function. (Dwarf_die::set_linkage_name): New function. (Dwarf_die::attribute): New function. (Dwarf_die::string_attribute): New function. (Dwarf_die::int_attribute): New function. (Dwarf_die::uint_attribute): New function. (Dwarf_die::ref_attribute): New function. (Dwarf_die::child_offset): New function. (Dwarf_die::sibling_offset): New function. (Dwarf_info_reader::check_buffer): New function. (Dwarf_info_reader::parse): New function. (Dwarf_info_reader::do_parse): New function. (Dwarf_info_reader::do_read_string_table): New function. (Dwarf_info_reader::lookup_reloc): New function. (Dwarf_info_reader::get_string): New function. (Dwarf_info_reader::visit_compilation_unit): New function. (Dwarf_info_reader::visit_type_unit): New function. (Sized_dwarf_line_info::Sized_dwarf_line_info): Use Sized_elf_reloc_mapper. (Sized_dwarf_line_info::symbol_section): Remove function. (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper. (Sized_dwarf_line_info::read_line_mappings): Remove object parameter, adjust callers. (Sized_dwarf_line_info::format_file_lineno): Fix type of cast. * dwarf_reader.h: Include <sys/types.h>. (class Track_relocs): Remove forward declaration. (class Elf_reloc_mapper): New class. (class Sized_elf_reloc_mapper): New class. (class Dwarf_abbrev_table): New class. (class Dwarf_range_list): New class. (class Dwarf_ranges_table): New class. (class Dwarf_pubnames_table): New class. (class Dwarf_die): New class. (class Dwarf_info_reader): New class. (Sized_dwarf_line_info::read_line_mappings): Remove object parameter. (Sized_dwarf_line_info::symbol_section): Remove member function. * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from base class. * gdb-index.cc: New source file. * gdb-index.h: New source file. * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info and .debug_types sections, call Layout::add_to_gdb_index. (Sized_relobj_incr::do_section_name): Implement. (Sized_relobj_incr::do_section_contents): Adjust parameter list and return type; Implement. (Sized_incr_dynobj::do_section_contents): Adjust parameter list and return type. * incremental.h (Sized_relobj_incr::do_section_contents): Adjust parameter list and return type. (Sized_incr_dynobj::do_section_contents): Likewise. * layout.cc: Include gdb-index.h. (Layout::Layout): Initialize gdb_index_data_. (Layout::init_fixed_output_section): Check for .gdb_index section. (Layout::add_to_gdb_index): New function. Instantiate. * layout.h: Add forward declaration for class Gdb_index. (Layout::add_to_gdb_index): New member function. (Layout::gdb_index_data_): New data member. * main.cc: Include gdb-index.h. (main): Print statistics for gdb index. * object.cc (Object::section_contents): Move code into do_section_contents. (need_decompressed_section): Check for sections needed when building gdb index. (build_compressed_section_map): Likewise. (Sized_relobj_file::do_read_symbols): Need local symbols when building gdb index. (Sized_relobj_file::do_layout): Track .debug_info and .debug_types sections; call Layout::add_to_gdb_index. (Sized_relobj_file::do_decompressed_section_contents): Call do_section_contents directly. * object.h (Object::do_section_contents): Adjust parameter list and return type. (Object::do_decompressed_section_contents): Call do_section_contents directly. (Sized_relobj_file::do_section_contents): Adjust parameter list and return type. * options.h (class General_options): Add --gdb-index option. * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter list and return type. * plugin.h (Sized_pluginobj::do_section_contents): Likewise. * reloc.h (Track_relocs::checkpoint): New function. (Track_relocs::reset): New function. * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh): New test cases. * testsuite/Makefile.in: Regenerate. * testsuite/gdb_index_test.cc: New test source file. * testsuite/gdb_index_test_1.sh: New test source file. * testsuite/gdb_index_test_2.sh: New test source file.
2012-03-13 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): FixCary Coutant
handling of DW_LNE_define_file.
2012-02-29 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):Cary Coutant
Call Object::decompressed_section_contents. * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info): New dtor. (Sized_dwarf_line_info::buffer_start_): New data member. * merge.cc (Output_merge_data::do_add_input_section): Call Object::decompressed_section_contents. (Output_merge_string::do_add_input_section): Likewise. * object.cc (need_decompressed_section): New function. (build_compressed_section_map): Decompress sections needed later. (Sized_relobj_file::do_decompressed_section_contents): New function. (Sized_relobj_file::do_discard_decompressed_sections): New function. * object.h (Object::decompressed_section_contents): New function. (Object::discard_decompressed_sections): New function. (Object::do_decompressed_section_contents): New function. (Object::do_discard_decompressed_sections): New function. (Compressed_section_info): New type. (Compressed_section_map): Include decompressed section contents. (Sized_relobj_file::do_decompressed_section_contents): New function. (Sized_relobj_file::do_discard_decompressed_sections): New function.
2012-01-28Update copyright year.Ian Lance Taylor
2011-12-172011-12-17 Cary Coutant <ccoutant@google.com>Cary Coutant
* dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts. * resolve.cc (Symbol_table::resolve): Likewise. * i386.cc (Target_i386::do_code_fill): Use char constants for nop arrays. * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2011-04-052011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>Paul Pluzhnikov
PR gold/12640 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds violation.
2011-03-10 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,Ian Lance Taylor
but mark earlier ones as non-canonical (offset_to_iterator): Update search target and example (do_addr2line): Return extra lines in a vector* (format_file_lineno): Extract from do_addr2line (one_addr2line): Add vector* out-param * dwarf_reader.h (Offset_to_lineno_entry): New field recording when a lineno entry appeared last for its instruction (Dwarf_line_info): Add vector* out-param * object.cc (Relocate_info): Pass NULL for the vector* out-param * symtab.cc (Odr_violation_compare): Include the lineno in the comparison again. (linenos_from_loc): New. Combine the canonical line for an address with its other lines. (True_if_intersect): New. Helper functor to make std::set_intersection a query. (detect_odr_violations): Compare sets of lines instead of just one line for each function. This became less deterministic, but has fewer false positives. * symtab.h: Declarations. * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to mix an optimized and non-optimized object in the same binary (odr_violation2.so): Same. * testsuite/Makefile.in: Regenerate from Makefile.am. * testsuite/debug_msg.cc (main): Make OdrDerived classes. * testsuite/debug_msg.sh: Update line numbers and add assertions. * testsuite/odr_violation1.cc: Use OdrDerived, in a non-optimized context. * testsuite/odr_violation2.cc: Make sure Ordering::operator() isn't inlined, and use OdrDerived in an optimized context. * testsuite/odr_header1.h: Defines OdrDerived, where optimization will change the first-instruction-in-the-destructor's file and line number. * testsuite/odr_header2.h: Defines OdrBase.
2010-12-20 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keepIan Lance Taylor
second of two consecutive entries with same offset.
2010-12-14Fix typos in gold.Ralf Wildenhues
gold/: * dwarf_reader.cc: Remove outdated comment. * gold-threads.cc: Fix typo in error message. * archive.cc: Fix typos in comments. * archive.h: Likewise. * arm-reloc-property.cc: Likewise. * arm-reloc-property.h: Likewise. * arm-reloc.def: Likewise. * arm.cc: Likewise. * attributes.h: Likewise. * cref.cc: Likewise. * ehframe.cc: Likewise. * fileread.h: Likewise. * gold.h: Likewise. * i386.cc: Likewise. * icf.cc: Likewise. * incremental.h: Likewise. * int_encoding.cc: Likewise. * layout.h: Likewise. * main.cc: Likewise. * merge.h: Likewise. * object.cc: Likewise. * object.h: Likewise. * options.cc: Likewise. * readsyms.cc: Likewise. * reduced_debug_output.cc: Likewise. * reloc.cc: Likewise. * script-sections.cc: Likewise. * sparc.cc: Likewise. * symtab.h: Likewise. * target-reloc.h: Likewise. * target.cc: Likewise. * target.h: Likewise. * timer.cc: Likewise. * timer.h: Likewise. * x86_64.cc: Likewise.
2010-12-01 * dwarf_reader.h (class Sized_dwarf_line_info): AddIan Lance Taylor
track_relocs_type_ field. * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info): Set track_relocs_type_. (Sized_dwarf_line_info::process_one_opcode): Ignore the section contents when using RELA relocs. (Sized_dwarf_line_info::read_relocs): Add the reloc addend to reloc_map_. * reloc.cc (Track_relocs::next_addend): New function. * reloc.h (class Track_relocs): Declare next_addend.
2010-11-17 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):Cary Coutant
Check for ".zdebug_line".
2010-07-12 * compressed_output.cc (zlib_decompress): New function.Cary Coutant
(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.
2009-12-14 Revert -Wshadow changes, all changes from:Ian Lance Taylor
2009-12-11 Doug Kwan <dougkwan@google.com> 2009-12-11 Nick Clifton <nickc@redhat.com> * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
2009-12-11Add -Wshadow to the gcc command line options used when compiling the binutils.Nick Clifton
Fix up all warnings generated by the addition of this switch.
2009-12-092009-12-08 Doug Kwan <dougkwan@google.com>Doug Kwan
* Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc. (HFILES): Add attributes.h and int_encoding.h. * Makefile.in: Regenerate. * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move function definitions to int_encoding.cc * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move prototypes to int_encoding.h * reduced_debug_output.cc (int_encoding.h): New include. (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move function definitions to int_encoding.cc (insert_into_vector, read_from_pointer): Move template definitions to int_encoding.h * attributes.cc: New file. * attributes.h: New file. * int_encoding.cc: New file. * int_encoding.h: New file.
2009-10-09 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):Ian Lance Taylor
Change read_shndx type to unsigned int. (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned int. (Sized_dwarf_line_info::read_line_mappings): Likewise. * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info): Change read_shndx type to unsigned int. (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned int. (Sized_dwarf_line_info::read_line_mappings): Likewise. * layout.cc (Layout::create_symtab_sections): Cast the result of local_symcount * symsize to off_t in the gold_assert.
2008-05-28elfcpp/:Ian Lance Taylor
* dwarf.h (enum DW_FORM): Define. gold/: * reduced_debug_output.cc: New file. * reduced_debug_output.h: New file. * options.h (class General_optoins): Add --strip-debug-non-line. * options.cc (General_options::finalize): Add strip_debug_non_line to the strip heirarchy. * layout.h (class Layout): Add debug_abbrev_ and debug_info_ fields. * layout.cc: Include "reduced_debug_output.h". (Layout::Layout): Initialize new fields. (line_only_debug_sections): New static array. (is_lines_only_debug_sections): New static inline function. (Layout::include_section): Handle --strip-debug-non-line. (Layout::make_output_section): If --strip-debug-non-line, build new output sections for .debug_abbrev and .debug_info. * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace gold. Warn about possible overflow. (read_signed_LEB_128): Likewise. * dwarf_reader.h: (read_unsigned_LEB_128): Declare. (read_signed_LEB_128): Declare. * Makefile.am (CCFILES): Add reduced_debug_output.cc. (HFILES): Add reduced_debug_output.h. * Makefile.in: Rebuild.
2008-05-01 * dwarf_reader.cc (next_generation_count): New static var.Craig Silverstein
(Addr2line_cache_entry): New struct. (addr2line_cache): New static var. (Dwarf_line_info::one_addr2line): Added caching. (Dwarf_line_info::clear_addr2line_cache): New function. * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add cache-size parameter. (Dwarf_line_info::one_addr2line_cache): New function. * symtab.cc (Symbol_table::detect_odr_violations): Pass new cache-size argument to one_addr2line(), and clear cache.
2008-04-19 * object.cc (Xindex::initialize_symtab_xindex): New function.Ian Lance Taylor
(Xindex::read_symtab_xindex): New function. (Xindex::sym_xindex_to_shndx): New function. (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if available. (Sized_relobj::do_initialize_xindex): New function. (Sized_relobj::do_read_symbols): Adjust section links. (Sized_relobj::symbol_section_and_value): Add is_ordinary parameter. Change all callers. (Sized_relobj::include_section_group): Adjust section links and symbol section indexes. (Sized_relobj::do_layout): Adjust section links. (Sized_relobj::do_count_local_symbols): Adjust section links and symbol section indexes. (Sized_relobj::do_finalize_local_symbols): Distinguish between ordinary and special symbols. (Sized_relobj::write_local_symbols): Add symtab_xindex and dynsym_xindex parameters. Change all callers. Adjust section links. Use SHN_XINDEX when needed. (Sized_relobj::get_symbol_location_info): Adjust section links. Don't get fooled by special symbols. * object.h (class Xindex): Define. (class Object): Add xindex_ parameter. Declare virtual functoin do_initialize_xindex. (Object::adjust_sym_shndx): New function. (Object::set_xindex): New protected function. (class Symbol_value): Add is_ordinary_shndx_ field. (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_. (Symbol_value::value): Assert ordinary section. (Symbol_value::initialize_input_to_output_map): Likewise. (Symbol_value::set_input_shndx): Add is_ordinary parameter. Change all callers. (Symbol_value::input_shndx): Add is_ordinary parameter. Change all callers. (class Sized_relobj): Update declarations. (Sized_relobj::local_symbol_input_shndx): Add is_ordinary parameter. Change all callers. (Sized_relobj::adjust_shndx): New function. * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_ field. (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section for SHT_DYNSYM section if available. Set dynsym_shndx_ field. (Sized_dynobj::read_dynsym_section): Adjust section links. (Sized_dynobj::read_dynamic): Likewise. (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust section links. (Sized_dynobj::do_initialize_xindex): New function. * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare do_initialize_xindex. (Sized_dynobj::adjust_shndx): New function. * layout.cc (Layout::Layout): Initialize symtab_xindex_ and dynsym_xindex_ fields. (Layout::finalize): Add a call to set_section_indexes before creating the symtab sections. (Layout::set_section_indexes): Don't do anything if the section already has a section index. (Layout::create_symtab_sections): Add shnum parameter. Change caller. Create .symtab_shndx section if needed. (Layout::create_shdrs): Add shstrtab_section parameter. Change caller. (Layout::allocated_output_section_count): New function. (Layout::create_dynamic_symtab): Create .dynsym_shndx section if needed. * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_ fields. Update declarations. (Layout::symtab_xindex): New function. (Layout::dynsym_xindex): New function. (class Write_symbols_task): Add layout_ field. (Write_symbols_task::Write_symbols_task): Add layout parameter. Change caller. * output.cc (Output_section_headers::Output_section_headers): Add shstrtab_section parameter. Change all callers. (Output_section_headers::do_sized_write): Store overflow values for section count and section string table section index in section header zero. (Output_file_header::do_sized_write): Check for overflow of section count and section string table section index. (Output_symtab_xindex::do_write): New function. (Output_symtab_xindex::endian_do_write): New function. * output.h (class Output_section_headers): Add shstrtab_section_. Update declarations. (class Output_symtab_xindex): Define. (Output_section::has_out_shndx): New function. * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_ field. (Symbol::init_base): Add st_shndx and is_ordinary parameters. Change all callers. (Sized_symbol::init): Likewise. (Symbol::output_section): Check for ordinary symbol. (Symbol_table::add_from_object): Remove orig_sym parameter. Add st_shndx, is_ordinary, and orig_st_shndx parameters. Change all callers. (Symbol_table::add_from_relobj): Add symndx_offset parameter. Change all callers. Simplify handling of symbols from sections not included in the link. (Symbol_table::add_from_dynobj): Handle ordinary symbol distinction. (Weak_alias_sorter::operator()): Assert that symbols are ordinary. (Symbol_table::sized_finalize_symbol): Handle ordinary symbol distinction. (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex parameters. Change all callers. (Symbol_table::sized_write_globals): Likewise. Handle ordinary symbol distinction. Use SHN_XINDEX when needed. (Symbol_table::write_section_symbol): Add symtab_xindex parameter. Change all callers. (Symbol_table::sized_write_section_symbol): Likewise. Use SHN_XINDEX when needed. * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update declarations. (Symbol::shndx): Add is_ordinary parameter. Change all callers. (Symbol::is_defined): Check is_ordinary. (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise. (Symbol::is_absolute, Symbol::is_common): Likewise. (class Sized_symbol): Update declarations. (class Symbol_table): Update declarations. * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary parameters. Change all callers. (Sized_symbol::override): Likewise. (Symbol_table::override): Likewise. (symbol_to_bits): Add is_ordinary parameter. Change all callers. (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx, is_ordinary, and orig_st_shndx parameters. Change all callers. * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol to be in an ordinary section. * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add object and is_ordinary parameters. Change all callers. (Sized_dwarf_line_info::read_relocs): Add object parameter. Change all callers. Don't add undefined or non-ordinary symbols to reloc_map_. (Sized_dwarf_line_info::read_line_mappings): Add object parameter. Change all callers. * dwarf_reader.h (class Sized_dwarf_line_info): Update declarations. * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol. * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links. (Sized_relobj::relocate_sections): Likewise. * target-reloc.h (scan_relocs): Adjust section symbol index. (scan_relocatable_relocs): Likewise. * i386.cc (Scan::local): Check for ordinary symbols. * sparc.cc (Scan::local): Likewise. * x86_64.cc (Scan::local): Likewise. * testsuite/binary_unittest.cc (Sized_binary_test): Update calls to symbol_section_and_value. * testsuite/many_sections_test.cc: New file. * testsuite/Makefile.am (BUILT_SOURCES): Define. (check_PROGRAMS): Add many_sections_test. (many_sections_test_SOURCES): Define. (many_sections_test_DEPENDENCIES): Define. (many_sections_test_LDFLAGS): Define. (BUILT_SOURCES): Add many_sections_define.h. (many_sections_define.h): New target. (BUILT_SOURCES): Add many_sections_check.h. (many_sections_check.h): New target. (check_PROGRAMS): Add many_sections_r_test. (many_sections_r_test_SOURCES): Define. (many_sections_r_test_DEPENDENCIES): Define. (many_sections_r_test_LDFLAGS): Define. (many_sections_r_test_LDADD): Define. (many_sections_r_test.o): New target. * testsuite/Makefile.in: Rebuild.
2008-04-03 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,David S. Miller
Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
2008-03-26 PR gold/5986Ian Lance Taylor
Fix problems building gold with gcc 4.3.0. * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define. (gold_error_at_location, gold_warning_at_location): Use it. * configure.ac: Check whether we can compile and use a template function with a printf attribute. * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value when jumping over bytes. * object.cc: Instantiate Object::read_section_data. * debug.h: Include <cstring> * dwarf_reader.cc: Include <algorithm> * main.cc: Include <cstring>. * options.cc: Include <cstring>. * output.cc: Include <cstring>. * script.cc: Include <cstring>. * script.h: Include <string>. * symtab.cc: Include <cstring> and <algorithm>. * target-select.cc: Include <cstring>. * version.cc: Include <string>. * testsuite/testmain.cc: Include <cstdlib>. * configure, config.in: Rebuild.
2008-03-13Update copyright years. Update language files.Ian Lance Taylor
2008-02-28From Craig Silverstein: Have Parameters point to General_options.Ian Lance Taylor
2008-01-18From Craig Silverstein: Handle quoted strings differently in versionIan Lance Taylor
scripts, and handle extern "C++" in the middle of a block.
2007-12-18Add section_size_type and section_offset_type, use them to replace aIan Lance Taylor
lot of instances of off_t.
2007-12-11From Craig Silverstein: Speed up ODR violation reporting.Ian Lance Taylor