aboutsummaryrefslogtreecommitdiff
path: root/gold/symtab.cc
AgeCommit message (Collapse)AuthorFilesLines
2013-04-15gold/Cary Coutant1-9/+18
* symtab.cc (Symbol_table::sized_write_globals): Subtract section starting address for relocatable link. * testsuite/Makefile.am (script_test_11): New test. * testsuite/Makefile.in: Regenerate. * testsuite/script_test_11.c: New source file. * testsuite/script_test_11.t: New linker script.
2013-03-20 * symtab.h (Symbol::clear_version): New function.Alan Modra1-7/+34
* symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object is_needed by weak references. Clear version for symbols defined in as-needed objects that are not needed.
2013-03-10 * gold.cc (queue_middle_tasks): Move detect_odr_violations..Alan Modra1-1/+3
* layout.cc (Layout_task_runner::run): ..to here. * symtab.h (struct Symbol_location): Extract from.. (class Symbol_table): ..here. * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location. * target.h (class Target): Add function_location and do_function_location functions. (class Sized_target): Add do_function_location. * object.h (class Sized_relobj_file): Move find_shdr.. (class Object): ..to here. * object.cc: Likewise. Update to suit. Instantiate. (Sized_relobj_file::find_eh_frame): Update find_shdr call. * powerpc.cc (class Powerpc_dynobj): New. (Target_powerpc::do_function_location): New function. (Powerpc_relobj::do_find_special_sections): Update find_shdr call. (Powerpc_dynobj::do_read_symbols): New function. (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
2012-09-09 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.Alan Modra1-26/+5
(Sized_target::gc_add_reference, do_gc_add_reference): New functions. * gc.h (gc_process_relocs): Call target gc_add_reference. * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym. * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol. (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove unnecessary cast. * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters to cater for when we don't need code offset. Update use. (Powerpc_relobj::access_from_map_, opd_valid_): New vars. (Powerpc_relobj::access_from_map, add_reference, opd_valid, set_opd_valid): New functions. (Target_powerpc::do_gc_add_reference): New function. (Target_powerpc::gc_process_relocs): Call gc()->add_reference on stashed refs. (Target_powerpc::do_gc_mark_symbol): New function.
2012-08-212012-08-21 Cary Coutant <ccoutant@google.com>Cary Coutant1-2/+4
gold/ * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert if --export-dynamic-symbol names an undef symbol.
2012-05-252012-05-25 Sriraman Tallam <tmsriram@google.com>Sriraman Tallam1-0/+1
* symtab.cc (Symbol_table::define_special_symbol): Initialize *poldsym to prevent uninitialized variable errors.
2012-05-22gold/Cary Coutant1-2/+3
* symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable object before exporting symbol.
2012-04-17 * archive.cc (Library_base::should_include_member): Check forCary Coutant1-6/+42
--export-dynamic-symbol. * options.h (class General_options): Add --export-dynamic-symbol. * symtab.cc (Symbol::should_add_dynsym_entry): Check for --export-dynamic-symbol. (Symbol_table::gc_mark_undef_symbols): Likewise. (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2011-10-31 * options.h (class General_options): Add --[no-]gnu-unique options.Cary Coutant1-0/+6
* symtab.cc (Symbol_table::sized_write_globals): Convert STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2011-10-312011-10-31 Sriraman Tallam <tmsriram@google.com>Sriraman Tallam1-27/+19
* symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to gc_mark_symbol. * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to gc_mark_symbol. Change to just keep the section associated with symbol. (Symbol_table::add_from_relobj): Mark symbols as not garbage when they are externally visible and --export-dynamic is turned on. (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2011-09-29 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):Cary Coutant1-0/+13
Check for NULL. * gold/symtab.cc (Symbol_table::add_from_relobj): Ignore version symbols during incremental update. (Symbol_table::add_from_dynobj): Likewise.
2011-09-28 * symtab.cc (Symbol_table::define_special_symbol): AlwaysIan Lance Taylor1-1/+3
canonicalize version string.
2011-08-01 * layout.cc (Layout::set_segment_offsets): Don't realign textCary Coutant1-5/+7
segment if -Ttext was specified. * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF file type. * object.h (Sized_relobj_file::e_type): New function. (Sized_relobj_file::e_type_): New data member. * symtab.cc (Symbol_table::add_from_relobj): Don't add section base address for ET_EXEC files. * target.cc (Target::do_make_elf_object_implementation): Allow ET_EXEC files with --just-symbols option.
2011-07-222011-07-22 Sriraman Tallam <tmsriram@google.com>Sriraman Tallam1-3/+3
* symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced only after checking if it cannot be forced local. * symtab.h (is_externally_visible): Check if the symbol is not forced local.
2011-07-08 PR gold/12279Ian Lance Taylor1-3/+3
* resolve.cc (Symbol_table::should_override): Add fromtype parameter. Change all callers. Give error when linking together TLS and non-TLS symbol. (Symbol_table::should_override_with_special): Add fromtype parameter. Change all callers. * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if there is no TLS segment if we have reported some errors. * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2011-06-29 PR gold/12818Ian Lance Taylor1-0/+1
* symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined symbols which are not used in a relocation.
2011-06-28 * symtab.cc (Symbol::versioned_name): New function.Ian Lance Taylor1-2/+23
(Symbol_table::add_to_final_symtab): Use versioned_name when appropriate. (Symbol_table::sized_write_symbol): Likewise. * symtab.h (class Symbol): Declare versioned_name. * stringpool.h (class Stringpool_template): Add variant of add which takes a std::basic_string. * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12. (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables. (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables. (ver_test_12.o): New target. * testsuite/Makefile.in: Rebuild.
2011-06-16 * symtab.cc (Warnings::issue_warning): Don't warn if relocationIan Lance Taylor1-0/+6
occurs in same object.
2011-06-08 * common.cc (Symbol_table::do_allocate_commons_list): For incrementalCary Coutant1-12/+25
update, allocate common from bss section's free list. * incremental-dump.cc (dump_incremental_inputs): Print flag for linker-defined symbols. * incremental.cc (Sized_incremental_binary::do_process_got_plt): Skip GOT and PLT entries that are no longer referenced. (Output_section_incremental_inputs::write_info_blocks): Mark linker-defined symbols. (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols. * output.cc (Output_section::allocate): New function. * output.h (Output_section::allocate): New function. * resolve.cc (Symbol_table::report_resolve_problem): Add case for linker-defined symbols. (Symbol::override_base_with_special): Copy is_predefined_ flag. * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag. (Symbol::init_base_output_data): Likewise. (Symbol::init_base_output_segment): Likewise. (Symbol::init_base_constant): Likewise. (Sized_symbol::init_output_data): Likewise. (Sized_symbol::init_output_segment): Likewise. (Sized_symbol::init_constant): Likewise. (Symbol_table::do_define_in_output_data): Likewise. (Symbol_table::do_define_in_output_segment): Likewise. (Symbol_table::do_define_as_constant): Likewise. * symtab.h (Symbol::is_predefined): New function. (Symbol::init_base_output_data): Add is_predefined parameter. (Symbol::init_base_output_segment): Likewise. (Symbol::init_base_constant): Likewise. (Symbol::is_predefined_): New data member. (Sized_symbol::init_output_data): Add is_predefined parameter. (Sized_symbol::init_output_segment): Likewise. (Sized_symbol::init_constant): Likewise. (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2011-06-08 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_relocCary Coutant1-5/+5
instead of emit_copy_reloc. (Copy_relocs::emit_copy_reloc): Refactor. (Copy_relocs::make_copy_reloc): New function. (Copy_relocs::add_copy_reloc): Remove. * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public section. (Copy_relocs::make_copy_reloc): New function. (Copy_relocs::add_copy_reloc): Remove. * gold.cc (queue_middle_tasks): Emit old COPY relocations from unchanged input files. * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag. * incremental.cc (Sized_incremental_binary::do_reserve_layout): Reserve BSS space for COPY relocations. (Sized_incremental_binary::do_emit_copy_relocs): New function. (Output_section_incremental_inputs::write_info_blocks): Record whether a symbol is copied from a shared object. (Sized_incr_dynobj::do_add_symbols): Record COPY relocations. * incremental.h (enum Incremental_shlib_symbol_flags): New type. (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant. (Incremental_input_entry_reader::get_output_symbol_index): Add is_copy parameter. (Incremental_binary::emit_copy_relocs): New function. (Incremental_binary::do_emit_copy_relocs): New function. (Sized_incremental_binary::Sized_incremental_binary): Initialize new data member. (Sized_incremental_binary::add_copy_reloc): New function. (Sized_incremental_binary::do_emit_copy_relocs): New function. (Sized_incremental_binary::Copy_reloc): New struct. (Sized_incremental_binary::Copy_relocs): New typedef. (Sized_incremental_binary::copy_relocs_): New data member. * symtab.cc (Symbol_table::add_from_incrobj): Change return type. * symtab.h (Symbol_table::add_from_incrobj): Change return type. * target.h (Sized_target::emit_copy_reloc): New function. * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2011-05-24 * incremental-dump.cc (dump_incremental_inputs): Print dynamic relocCary Coutant1-15/+15
info; adjust display of GOT entries. * incremental.cc (Sized_incremental_binary::setup_readers): Allocate vector of input objects; remove file_status_. (Sized_incremental_binary::do_reserve_layout): Remove file_status_. (Sized_incremental_binary::do_process_got_plt): Adjust calls to got_plt reader; call target hooks to reserve GOT entries. (Output_section_incremental_inputs::set_final_data_size): Adjust size of input file info header and GOT info entry. (Output_section_incremental_inputs::write_info_blocks): Write dynamic relocation info. (Got_plt_view_info::got_descriptor): Remove. (Got_plt_view_info::sym_index): New data member. (Got_plt_view_info::input_index): New data member. (Local_got_offset_visitor::visit): Write input file index. (Global_got_offset_visitor::visit): Write 0 for input file index. (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor with sym_index and input_index. (Output_section_incremental_inputs::write_got_plt): Adjust size of incremental info GOT entry; replace got_descriptor with input_index. (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record map from input file index to object. (Sized_relobj_incr::do_layout): Replace direct data member reference with accessor function. (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class. * incremental.h (Incremental_input_entry_reader::get_symbol_offset): Adjust size of input file info header. (Incremental_input_entry_reader::get_first_dyn_reloc): New function. (Incremental_input_entry_reader::get_dyn_reloc_count): New function. (Incremental_input_entry_reader::get_input_section): Adjust size of input file info header. (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size of incremental info GOT entry. (Incremental_got_plt_reader::get_got_desc): Remove. (Incremental_got_plt_reader::get_got_symndx): New function. (Incremental_got_plt_reader::get_got_input_index): New function. (Sized_incremental_binary::Sized_incremental_binary): Remove file_status_; add input_objects_. (Sized_incremental_binary::~Sized_incremental_binary): Remove. (Sized_incremental_binary::set_file_is_unchanged): Remove. (Sized_incremental_binary::file_is_unchanged): Remove. (Sized_incremental_binary::set_input_object): New function. (Sized_incremental_binary::input_object): New function. (Sized_incremental_binary::file_status_): Remove. (Sized_incremental_binary::input_objects_): New data member. (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all references. (Sized_relobj_incr::invalid_address): Move to base class. (Sized_relobj_incr::is_output_section_offset_invalid): Move to base class. (Sized_relobj_incr::do_output_section_offset): Likewise. (Sized_relobj_incr::do_for_all_local_got_entries): Likewise. (Sized_relobj_incr::section_offsets_): Likewise. * object.cc (Sized_relobj::do_for_all_local_got_entries): New function. (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_. (Sized_relobj_file::layout_section): Replace refs to section_offsets_ with accessor function. (Sized_relobj_file::do_layout): Likewise. (Sized_relobj_file::do_layout_deferred_sections): Likewise. (Sized_relobj_file::do_for_all_local_got_entries): Move to base class. (Sized_relobj_file::compute_final_local_value): Replace refs to section_offsets_ with accessor function. (Sized_relobj_file::do_finalize_local_symbols): Likewise. * object.h (Relobj::Relobj): Initialize new data members. (Relobj::add_dyn_reloc): New function. (Relobj::first_dyn_reloc): New function. (Relobj::dyn_reloc_count): New function. (Relobj::first_dyn_reloc_): New data member. (Relobj::dyn_reloc_count_): New data member. (Sized_relobj): Rename Sized_relobj_base to this; adjust all references. (Sized_relobj::Address): New typedef. (Sized_relobj::invalid_address): Move here from child class. (Sized_relobj::Sized_relobj): Initialize new data members. (Sized_relobj::sized_relobj): New function. (Sized_relobj::is_output_section_offset_invalid): Move here from child class. (Sized_relobj::get_output_section_offset): Likewise. (Sized_relobj::local_has_got_offset): Likewise. (Sized_relobj::local_got_offset): Likewise. (Sized_relobj::set_local_got_offset): Likewise. (Sized_relobj::do_for_all_local_got_entries): Likewise. (Sized_relobj::clear_got_offsets): New function. (Sized_relobj::section_offsets): Move here from child class. (Sized_relobj::do_output_section_offset): Likewise. (Sized_relobj::do_set_section_offset): Likewise. (Sized_relobj::Local_got_offsets): Likewise. (Sized_relobj::local_got_offsets_): Likewise. (Sized_relobj::section_offsets_): Likewise. (Sized_relobj_file): Rename Sized_relobj to this; adjust all references. (Sized_relobj_file::is_output_section_offset_invalid): Move to base class. (Sized_relobj_file::sized_relobj): New function (Sized_relobj_file::local_has_got_offset): Move to base class. (Sized_relobj_file::local_got_offset): Likewise. (Sized_relobj_file::set_local_got_offset): Likewise. (Sized_relobj_file::get_output_section_offset): Likewise. (Sized_relobj_file::do_for_all_local_got_entries): Likewise. (Sized_relobj_file::do_output_section_offset): Likewise. (Sized_relobj_file::do_set_section_offset): Likewise. (Sized_relobj_file::Local_got_offsets): Likewise. (Sized_relobj_file::local_got_offsets_): Likewise. (Sized_relobj_file::section_offsets_): Likewise. * output.cc (Output_reloc::Output_reloc): Adjust type of relobj (all constructors). (set_needs_dynsym_index): Convert relobj to derived class pointer. (Output_reloc::get_symbol_index): Likewise. (Output_reloc::local_section_offset): Likewise. (Output_reloc::get_address): Likewise. (Output_reloc::symbol_value): Likewise. (Output_data_got::reserve_slot): Move to class definition. (Output_data_got::reserve_local): New function. (Output_data_got::reserve_slot_for_global): Remove. (Output_data_got::reserve_global): New function. * output.h (Output_reloc::Output_reloc): Adjust type of relobj (all constructors, two instantiations). (Output_reloc::get_relobj): New function (two instantiations). (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type. (Output_data_reloc_base::add): Convert relobj to derived class pointer. (Output_data_reloc::add_global): Adjust type of relobj. (Output_data_reloc::add_global_relative): Likewise. (Output_data_reloc::add_symbolless_global_addend): Likewise. (Output_data_reloc::add_local): Likewise. (Output_data_reloc::add_local_relative): Likewise. (Output_data_reloc::add_symbolless_local_addend): Likewise. (Output_data_reloc::add_local_section): Likewise. (Output_data_reloc::add_output_section): Likewise. (Output_data_reloc::add_absolute): Likewise. (Output_data_reloc::add_target_specific): Likewise. (Output_data_got::reserve_slot): Move definition here. (Output_data_got::reserve_local): New function. (Output_data_got::reserve_global): New function. * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to section_offsets_ with accessor function. (Sized_relobj_file::write_sections): Likewise. (Sized_relobj_file::do_relocate_sections): Likewise. * target.h (Sized_target::reserve_local_got_entry): New function. (Sized_target::reserve_global_got_entry): New function. * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function. (Target_x86_64::reserve_global_got_entry): New function. (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2011-04-12 * archive.cc (Archive::include_member): Adjust call toCary Coutant1-0/+72
report_object. (Add_archive_symbols::run): Track argument serial numbers. (Lib_group::include_member): Likewise. (Add_lib_group_symbols::run): Adjust call to report_archive_begin. * archive.h (Incremental_archive_entry::Archive_member): Initialize arg_serial_. (Archive_member::arg_serial_): New data member. * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL. (Sized_dynobj::do_add_symbols): Track symbols when doing an incremental link. (Sized_dynobj::do_for_all_local_got_entries): New function. * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New function. * fileread.cc (get_mtime): New function. * fileread.h (get_mtime): New function. * gold.cc (queue_initial_tasks): Check for incremental update. (process_incremental_input): New function. (queue_middle_tasks): Don't force valid target for incremental update. * incremental-dump.cc (find_input_containing_global): Adjust size of symbol info entry. (dump_incremental_inputs): Dump argument serial number and in_system_directory flag; bias shndx by 1; print symbol names when dumping per-file symbol lists; use new symbol info readers. * incremental.cc (Output_section_incremental_inputs:update_data_size): New function. (Sized_incremental_binary::setup_readers): Setup input readers for each input file; build maps for files added from libraries and scripts. (Sized_incremental_binary::check_input_args): New function. (Sized_incremental_binary::do_check_inputs): Build map of argument serial numbers to input arguments. (Sized_incremental_binary::do_file_has_changed): Rename do_file_is_unchanged to this; compare file modification times. (Sized_incremental_binary::do_init_layout): New function. (Sized_incremental_binary::do_reserve_layout): New function. (Sized_incremental_binary::do_get_input_reader): Remove. (Sized_incremental_binary::get_symtab_view): New function. (Incremental_checker::can_incrementally_link_output_file): Remove. (Incremental_inputs::report_command_line): Exclude --debug options. (Incremental_inputs::report_archive_begin): Add parameter; track argument serial numbers; don't put input file entry for archive before archive members. (Incremental_inputs::report_archive_end): Put input file entry for archive after archive members. (Incremental_inputs::report_object): Add parameter; track argument serial numbers and in_system_directory flag. (Incremental_inputs::report_script): Add parameter; track argument serial numbers. (Output_section_incremental_inputs::set_final_data_size): Adjust size of symbol info entry; check for forwarding symbols. (Output_section_incremental_inputs::write_input_files): Write in_system_directory flag and argument serial number. (Output_section_incremental_inputs::write_info_blocks): Map section indices between incremental info and original input file; store input section index for each symbol. (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor; change operator() to visit(). (class Global_got_offset_visitor): Likewise. (class Global_symbol_visitor_got_plt): (Output_section_incremental_inputs::write_got_plt): Use new visitor classes. (Sized_incr_relobj::Sized_incr_relobj): New constructor. (Sized_incr_relobj::do_read_symbols): New function. (Sized_incr_relobj::do_layout): New function. (Sized_incr_relobj::do_layout_deferred_sections): New function. (Sized_incr_relobj::do_add_symbols): New function. (Sized_incr_relobj::do_should_include_member): New function. (Sized_incr_relobj::do_for_all_global_symbols): New function. (Sized_incr_relobj::do_for_all_local_got_entries): New function. (Sized_incr_relobj::do_section_size): New function. (Sized_incr_relobj::do_section_name): New function. (Sized_incr_relobj::do_section_contents): New function. (Sized_incr_relobj::do_section_flags): New function. (Sized_incr_relobj::do_section_entsize): New function. (Sized_incr_relobj::do_section_address): New function. (Sized_incr_relobj::do_section_type): New function. (Sized_incr_relobj::do_section_link): New function. (Sized_incr_relobj::do_section_info): New function. (Sized_incr_relobj::do_section_addralign): New function. (Sized_incr_relobj::do_initialize_xindex): New function. (Sized_incr_relobj::do_get_global_symbol_counts): New function. (Sized_incr_relobj::do_read_relocs): New function. (Sized_incr_relobj::do_gc_process_relocs): New function. (Sized_incr_relobj::do_scan_relocs): New function. (Sized_incr_relobj::do_count_local_symbols): New function. (Sized_incr_relobj::do_finalize_local_symbols): New function. (Sized_incr_relobj::do_set_local_dynsym_indexes): New function. (Sized_incr_relobj::do_set_local_dynsym_offset): New function. (Sized_incr_relobj::do_relocate): New function. (Sized_incr_relobj::do_set_section_offset): New function. (Sized_incr_dynobj::Sized_incr_dynobj): New function. (Sized_incr_dynobj::do_read_symbols): New function. (Sized_incr_dynobj::do_layout): New function. (Sized_incr_dynobj::do_add_symbols): New function. (Sized_incr_dynobj::do_should_include_member): New function. (Sized_incr_dynobj::do_for_all_global_symbols): New function. (Sized_incr_dynobj::do_for_all_local_got_entries): New function. (Sized_incr_dynobj::do_section_size): New function. (Sized_incr_dynobj::do_section_name): New function. (Sized_incr_dynobj::do_section_contents): New function. (Sized_incr_dynobj::do_section_flags): New function. (Sized_incr_dynobj::do_section_entsize): New function. (Sized_incr_dynobj::do_section_address): New function. (Sized_incr_dynobj::do_section_type): New function. (Sized_incr_dynobj::do_section_link): New function. (Sized_incr_dynobj::do_section_info): New function. (Sized_incr_dynobj::do_section_addralign): New function. (Sized_incr_dynobj::do_initialize_xindex): New function. (Sized_incr_dynobj::do_get_global_symbol_counts): New function. (make_sized_incremental_object): New function. (Incremental_library::copy_unused_symbols): New function. (Incremental_library::do_for_all_unused_symbols): New function. * incremental.h (enum Incremental_input_flags): New type. (class Incremental_checker): Remove. (Incremental_input_entry::Incremental_input_entry): Add argument serial number. (Incremental_input_entry::arg_serial): New function. (Incremental_input_entry::set_is_in_system_directory): New function. (Incremental_input_entry::is_in_system_directory): New function. (Incremental_input_entry::arg_serial_): New data member. (Incremental_input_entry::is_in_system_directory_): New data member. (class Script_info): Move here from script.h. (Script_info::Script_info): Add filename parameter. (Script_info::filename): New function. (Script_info::filename_): New data member. (Incremental_script_entry::Incremental_script_entry): Add argument serial number. (Incremental_object_entry::Incremental_object_entry): Likewise. (Incremental_object_entry::add_input_section): Build list of input sections with map to original shndx. (Incremental_object_entry::get_input_section_index): New function. (Incremental_object_entry::shndx_): New data member. (Incremental_object_entry::name_key_): Rename; adjust all refs. (Incremental_object_entry::sh_size_): Rename; adjust all refs. (Incremental_archive_entry::Incremental_archive_entry): Add argument serial number. (Incremental_inputs::report_archive_begin): Likewise. (Incremental_inputs::report_object): Likewise. (Incremental_inputs::report_script): Likewise. (class Incremental_global_symbol_reader): New class. (Incremental_input_entry_reader::Incremental_input_entry_reader): Read and store flags and input file type. (Incremental_input_entry_reader::arg_serial): New function. (Incremental_input_entry_reader::type): Extract type from flags. (Incremental_input_entry_reader::is_in_system_directory): New function. (Incremental_input_entry_reader::get_input_section_count): Call accessor function for type. (Incremental_input_entry_reader::get_symbol_offset): Call accessor function for type; adjust size of global symbol entry. (Incremental_input_entry_reader::get_global_symbol_count): Call accessor function for type. (Incremental_input_entry_reader::get_object_count): Likewise. (Incremental_input_entry_reader::get_object_offset): Likewise. (Incremental_input_entry_reader::get_member_count): Likewise. (Incremental_input_entry_reader::get_unused_symbol_count): Likewise. (Incremental_input_entry_reader::get_member_offset): Likewise. (Incremental_input_entry_reader::get_unused_symbol): Likewise. (Incremental_input_entry_reader::Global_symbol_info): Remove. (Incremental_input_entry_reader::get_global_symbol_info): Remove. (Incremental_input_entry_reader::get_global_symbol_reader): New function. (Incremental_input_entry_reader::get_output_symbol_index): New function. (Incremental_input_entry_reader::type_): Remove. (Incremental_input_entry_reader::flags_): New data member. (Incremental_inputs_reader::input_file_offset): New function. (Incremental_inputs_reader::input_file_index): New function. (Incremental_inputs_reader::input_file): Call input_file_offset. (Incremental_inputs_reader::input_file_at_offset): New function. (Incremental_relocs_reader::get_r_type): Reformat. (Incremental_relocs_reader::get_r_shndx): Reformat. (Incremental_relocs_reader::get_r_offset): Reformat. (Incremental_relocs_reader::data): New function. (Incremental_binary::Incremental_binary): Initialize new data members. (Incremental_binary::check_inputs): Add cmdline parameter. (Incremental_binary::file_is_unchanged): Remove. (Input_reader::arg_serial): New function. (Input_reader::get_unused_symbol_count): New function. (Input_reader::get_unused_symbol): New function. (Input_reader::do_arg_serial): New function. (Input_reader::do_get_unused_symbol_count): New function. (Input_reader::do_get_unused_symbol): New function. (Incremental_binary::input_file_count): New function. (Incremental_binary::get_input_reader): Change signature to use index instead of filename. (Incremental_binary::file_has_changed): New function. (Incremental_binary::get_input_argument): New function. (Incremental_binary::get_library): New function. (Incremental_binary::get_script_info): New function. (Incremental_binary::init_layout): New function. (Incremental_binary::reserve_layout): New function. (Incremental_binary::output_file): New function. (Incremental_binary::do_check_inputs): New function. (Incremental_binary::do_file_is_unchanged): Remove. (Incremental_binary::do_file_has_changed): New function. (Incremental_binary::do_init_layout): New function. (Incremental_binary::do_reserve_layout): New function. (Incremental_binary::do_input_file_count): New function. (Incremental_binary::do_get_input_reader): Change signature. (Incremental_binary::input_args_map_): New data member. (Incremental_binary::library_map_): New data member. (Incremental_binary::script_map_): New data member. (Sized_incremental_binary::Sized_incremental_binary): Initialize new data members. (Sized_incremental_binary::output_section): New function. (Sized_incremental_binary::inputs_reader): Add const. (Sized_incremental_binary::symtab_reader): Add const. (Sized_incremental_binary::relocs_reader): Add const. (Sized_incremental_binary::got_plt_reader): Add const. (Sized_incremental_binary::get_symtab_view): New function. (Sized_incremental_binary::Inputs_reader): New typedef. (Sized_incremental_binary::Input_entry_reader): New typedef. (Sized_incremental_binary::do_check_inputs): Add cmdline parameter. (Sized_incremental_binary::do_file_is_unchanged): Remove. (Sized_incremental_binary::do_file_has_changed): New function. (Sized_incremental_binary::do_init_layout): New function. (Sized_incremental_binary::do_reserve_layout): New function. (Sized_input_reader::Inputs_reader): Remove. (Sized_input_reader::Input_entry_reader): Remove. (Sized_input_reader::do_arg_serial): New function. (Sized_input_reader::do_get_unused_symbol_count): New function. (Sized_input_reader::do_get_unused_symbol): New function. (Sized_incremental_binary::do_input_file_count): New function. (Sized_incremental_binary::do_get_input_reader): Change signature; use index instead of filename. (Sized_incremental_binary::section_map_): New data member. (Sized_incremental_binary::input_entry_readers_): New data member. (class Sized_incr_relobj): New class. (class Sized_incr_dynobj): New class. (make_sized_incremental_object): New function. (class Incremental_library): New class. * layout.cc (Free_list::num_lists): New static data member. (Free_list::num_nodes): New static data member. (Free_list::num_removes): New static data member. (Free_list::num_remove_visits): New static data member. (Free_list::num_allocates): New static data member. (Free_list::num_allocate_visits): New static data member. (Free_list::init): New function. (Free_list::remove): New function. (Free_list::allocate): New function. (Free_list::dump): New function. (Free_list::print_stats): New function. (Layout_task_runner::run): Resize output file for incremental updates. (Layout::Layout): Initialize new data members. (Layout::set_incremental_base): New function. (Layout::init_fixed_output_section): New function. (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for incremental updates. (Layout::create_gold_note): Do not create gold note section for incremental updates. (Layout::set_segment_offsets): Do not recalculate RELRO alignment for incremental updates. (Layout::set_section_offsets): For incremental updates, allocate space from free list. (Layout::create_symtab_sections): Layout with offsets relative to start of section; for incremental updates, allocate space from free list. (Layout::create_shdrs): For incremental updates, allocate space from free list. (Layout::finish_dynamic_section): For incremental updates, do not check --as-needed (fixed in subsequent patch). * layout.h (class Free_list): New class. (Layout::set_incremental_base): New function. (Layout::incremental_base): New function. (Layout::init_fixed_output_section): New function. (Layout::allocate): New function. (Layout::incremental_base_): New data member. (Layout::free_list_): New data member. * main.cc (main): Print Free_list statistics. * object.cc (Relobj::finalize_incremental_relocs): Add clear_counts parameter; clear counts only when clear_counts is set. (Sized_relobj::Sized_relobj): Initialize new base class. (Sized_relobj::do_layout): Don't report special sections. (Sized_relobj::do_for_all_local_got_entries): New function. (Sized_relobj::write_local_symbols): Add symtab_off parameter; add symtab_off to all symbol table offsets. (Sized_relobj::do_get_global_symbol_counts): Add typename keyword. * object.h (class Got_offset_list): Move to top of file. (Object::Object): Allow case where input_file == NULL. (Object::~Object): Likewise. (Object::input_file): Assert that input_file != NULL. (Object::lock): Allow case where input_file == NULL. (Object::unlock): Likewise. (Object::is_locked): Likewise. (Object::token): Likewise. (Object::release): Likewise. (Object::is_incremental): New function. (Object::get_mtime): New function. (Object::for_all_local_got_entries): New function. (Object::clear_view_cache_marks): Allow case where input_file == NULL. (Object::set_is_in_system_directory): New function. (Object::is_in_system_directory): New function. (Object::do_is_incremental): New function. (Object::do_get_mtime): New function. (Object::do_for_all_local_got_entries): New function. (Object::is_in_system_directory_): New data member. (Relobj::finalize_incremental_relocs): Add clear_counts parameter. (class Sized_relobj_base): New class. (class Sized_relobj): Derive from Sized_relobj_base. (class Sized_relobj::Symbols): Redeclare from base class. (class Sized_relobj::local_got_offset_list): Remove. (class Sized_relobj::Output_sections): Redeclare from base class. (class Sized_relobj::do_for_all_local_got_entries): New function. (class Sized_relobj::write_local_symbols): Add offset parameter. (class Sized_relobj::local_symbol_offset_): Update comment. (class Sized_relobj::local_dynsym_offset_): Update comment. * options.cc (Input_arguments::add_file): Remove const. * options.h (Input_file_argument::Input_file_argument): Initialize arg_serial_ (all constructors). (Input_file_argument::set_arg_serial): New function. (Input_file_argument::arg_serial): New function. (Input_file_argument::arg_serial_): New data member. (Input_arguments::Input_arguments): Initialize file_count_. (Input_arguments::add_file): Remove const. (Input_arguments::number_of_input_files): New function. (Input_arguments::file_count_): New data member. (Command_line::number_of_input_files): Call Input_arguments::number_of_input_files. * output.cc (Output_segment_headers::Output_segment_headers): Set current size. (Output_section::Input_section::current_data_size): New function. (Output_section::Output_section): Initialize new data members. (Output_section::add_input_section): Don't do merge sections for an incremental link; allocate space from free list for an incremental update. (Output_section::add_output_section_data): Allocate space from free list for an incremental update. (Output_section::update_data_size): New function. (Output_section::set_fixed_layout): New function. (Output_section::reserve): New function. (Output_segment::set_section_addresses): Remove const. (Output_segment::set_section_list_addresses): Remove const; allocate space from free list for an incremental update. (Output_segment::set_offset): Adjust size of RELRO segment for an incremental update. * output.h (Output_data::current_data_size): Move here from child classes. (Output_data::pre_finalize_data_size): New function. (Output_data::update_data_size): New function. (Output_section_headers::update_data_size): new function. (Output_section_data_build::current_data_size): Move to Output_data. (Output_data_strtab::update_data_size): New function. (Output_section::current_data_size): Move to Output_data. (Output_section::set_fixed_layout): New function. (Output_section::has_fixed_layout): New function. (Output_section::reserve): New function. (Output_section::update_data_size): New function. (Output_section::has_fixed_layout_): New data member. (Output_section::free_list_): New data member. (Output_segment::set_section_addresses): Remove const. (Output_segment::set_section_list_addresses): Remove const. * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries): New function. * plugin.h (Sized_pluginobj::do_for_all_local_got_entries): New function. * readsyms.cc (Read_symbols::do_read_symbols): Add library parameter when calling Add_symbols constructor; store argument serial number for members of a lib group. (Add_symbols::locks): Allow case where token == NULL. (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib. (Read_member::~Read_member): New function. (Read_member::is_runnable): New function. (Read_member::locks): New function. (Read_member::run): New function. (Check_script::~Check_script): New function. (Check_script::is_runnable): New function. (Check_script::locks): New function. (Check_script::run): New function. (Check_library::~Check_library): New function. (Check_library::is_runnable): New function. (Check_library::locks): New function. (Check_library::run): New function. * readsyms.h (Add_symbols::Add_symbols): Add library parameter. (Add_symbols::library_): New data member. (class Read_member): New class. (class Check_script): New class. (class Check_library): New class. * reloc.cc (Read_relocs::is_runnable): Allow case where token == NULL. (Read_relocs::locks): Likewise. (Scan_relocs::locks): Likewise. (Relocate_task::locks): Likewise. (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs to clear counters. (Sized_relobj::incremental_relocs_scan): Fix comment. (Sized_relobj::do_relocate): Pass output file offset to write_local_symbols. (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size from class declaration. * script.cc (read_input_script): Allocate Script_info; pass argument serial number to report_script. * script.h (class Script_info): Move to incremental.h. * symtab.cc (Symbol_table::add_from_incrobj): New function. * symtab.h (Symbol_table::add_from_incrobj): New function. (Symbol_table::set_file_offset): New function.
2011-03-10 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,Ian Lance Taylor1-54/+124
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.
2011-02-182010-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>Rafael Ávila de Espíndola1-0/+14
* symtab.cc (Symbol::should_add_dynsym_entry) Return false for plugin only symbols. (Symbol_table::sized_finalize_symbol) Mark symbol only present in plugin files as not needed in the symbol table.
2011-02-05 * symtab.cc (Odr_violation_compare::operator()): Sort by just theIan Lance Taylor1-12/+28
filename.
2011-01-24 * plugin.cc (class Plugin_rescan): Define new class.Ian Lance Taylor1-2/+6
(Plugin_manager::claim_file): Set any_claimed_. (Plugin_manager::save_archive): New function. (Plugin_manager::save_input_group): New function. (Plugin_manager::all_symbols_read): Create Plugin_rescan task if necessary. (Plugin_manager::new_undefined_symbol): New function. (Plugin_manager::rescan): New function. (Plugin_manager::rescannable_defines): New function. (Plugin_manager::add_input_file): Set any_added_. * plugin.h (class Plugin_manager): define new fields rescannable_, undefined_symbols_, any_claimed_, and any_added_. Declare Plugin_rescan as friend. Declare new functions. (Plugin_manager::Rescannable): Define type. (Plugin_manager::Rescannable_list): Define type. (Plugin_manager::Undefined_symbol_list): Define type. (Plugin_manager::Plugin_manager): Initialize new fields. * archive.cc (Archive::defines_symbol): New function. (Add_archive_symbols::run): Pass archive to plugins if any. * archive.h (class Archive): Declare defines_symbol. * readsyms.cc (Input_group::~Input_group): New function. (Finish_group::run): Pass input_group to plugins if any. * readsyms.h (class Input_group): Declare destructor. * symtab.cc (add_from_object): Pass undefined symbol to plugins if any.
2010-10-022010-10-02 Doug Kwan <dougkwan@google.com>Doug Kwan1-8/+0
* symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move defintion to symtab.h * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change declaration to defintion.
2010-08-25 * archive.cc: Formatting fixes: Remove whitespace betweenNick Clifton1-8/+8
typename and following asterisk. Remove whitespace between function name and opening parenthesis. * archive.h: Likewise. * arm.cc: Likewise. * attributes.cc: Likewise. * attributes.h: Likewise. * common.cc: Likewise. * copy-relocs.cc: Likewise. * dirsearch.h: Likewise. * dynobj.cc: Likewise. * ehframe.cc: Likewise. * ehframe.h: Likewise. * expression.cc: Likewise. * fileread.cc: Likewise. * fileread.h: Likewise. * gc.h: Likewise. * gold-threads.cc: Likewise. * gold.cc: Likewise. * i386.cc: Likewise. * icf.h: Likewise. * incremental-dump.cc: Likewise. * incremental.cc: Likewise. * layout.cc: Likewise. * layout.h: Likewise. * main.cc: Likewise. * merge.cc: Likewise. * merge.h: Likewise. * object.cc: Likewise. * object.h: Likewise. * options.cc: Likewise. * options.h: Likewise. * output.cc: Likewise. * output.h: Likewise. * plugin.cc: Likewise. * plugin.h: Likewise. * powerpc.cc: Likewise. * reloc.cc: Likewise. * script-c.h: Likewise. * script-sections.cc: Likewise. * script.cc: Likewise. * stringpool.cc: Likewise. * symtab.cc: Likewise. * symtab.h: Likewise. * target.cc: Likewise. * timer.cc: Likewise. * timer.h: Likewise. * version.cc: Likewise. * x86_64.cc: Likewise.
2010-08-132010-08-12 Cary Coutant <ccoutant@google.com>Doug Kwan1-0/+2
Doug Kwan <dougkwan@google.com> * resolve.cc (Symbol_table::should_override): When a weak dynamic defintion overrides non-weak undef, remember that the original undef is not weak. * symtab.cc (Symbol_table::sized_write_global): For undef without an original weak binding, set binding to global in output. * testsuite/Makefile.am: Add new test strong_ref_weak_def. * testsuite/Makefile.in: Regenerate. * testsuite/strong_ref_weak_def.sh: New file. * testsuite/strong_ref_weak_def_1.c: Ditto. * testsuite/strong_ref_weak_def_2.c: Ditto.
2010-08-02 PR 11855Ian Lance Taylor1-34/+65
* script.cc (Script_options::Script_options): Initialize symbol_definitions_ and symbol_references_. (Script_options::add_symbol_assignment): Update symbol_definitions_ and symbol_references_. (Script_options::add_symbol_reference): New function. (script_symbol): New function. * script.h (class Script_options): Add symbol_definitions_ and symbol_references_ fields. (Script_options::referenced_const_iterator): New type. (Script_options::referenced_begin): New function. (Script_options::referenced_end): New function. (Script_options::is_referenced): New function. (Script_options::any_unreferenced): New function. * script-c.h (script_symbol): Declare. * yyscript.y (exp): Call script_symbol. * symtab.cc: Include "script.h". (Symbol_table::gc_mark_undef_symbols): Add layout parameter. Change all callers. Check symbols referenced by scripts. (Symbol_table::add_undefined_symbols_from_command_line): Add layout parameter. Change all callers. (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise. Break out loop body. Check symbols referenced by scripts. (Symbol_table::add_undefined_symbol_from_command_line): New function broken out of do_add_undefined_symbols_from_command_line. * symtab.h (class Symbol_table): Update declarations. * archive.cc: Include "layout.h". (Archive::should_include_member): Add layout parameter. Change all callers. Check for symbol mentioned in expression. * archive.h (class Archive): Update declaration. * object.cc (Sized_relobj::do_should_include_member): Add layout parameter. * object.h (Object::should_include_member): Add layout parameter. Change all callers. (Object::do_should_include_member): Add layout parameter. (class Sized_relobj): Update declaration. * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout parameter. * dynobj.h (class Sized_dynobj): Update declaration. * plugin.cc (Sized_pluginobj::do_should_include_member): Add layout parameter. * plugin.h (class Sized_pluginobj): Update declaration.
2010-07-09 * resolve.cc (Symbol_table::resolve): Remember whether undef wasCary Coutant1-3/+9
weak when resolving to a dynamic def. (Symbol_table::should_override): Add adjust_dyndef flag; set it for weak undef/dynamic def cases. Adjust callers. * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and undef_binding_weak_. (Symbol_table::sized_write_globals): Adjust symbol binding. (Symbol_table::sized_write_symbol): Add binding parameter. * symtab.h (Symbol::set_undef_binding): New method. (Symbol::is_undef_binding_weak): New method. (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members. (Symbol_table::should_override): Add new parameter. (Symbol_table::sized_write_symbol): Add new parameter. * testsuite/weak_undef_file1.cc: Add new test case. * testsuite/weak_undef_file2.cc: Fix header comment. * testsuite/weak_undef_test.cc: Add new test case.
2010-06-27 * symtab.cc (detect_odr_violations): When reporting an ODRIan Lance Taylor1-7/+16
violation, report an object where the symbol is defined.
2010-04-202010-04-18 Sriraman Tallam <tmsriram@google.com>Sriraman Tallam1-4/+6
* icf.cc (get_section_contents): Check for preemptible functions. Ignore addend when appropriate. * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for section folded. (add_from_relobj): Check for section folded. (set_dynsym_indexes): Fix call to should_add_dynsym_entry. * symtab.h (should_add_dynsym_entry): Add new parameter. * target-reloc.h (scan_relocs): Check for section folded. * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc): Check reloc types for function pointers in shared objects. * testsuite/Makefile.am (icf_virtual_function_folding_test): New test case. (icf_preemptible_functions_test): New test case. (icf_string_merge_test): New test case. * testsuite.Makefile.in: Regenerate. * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and bar_glob. Refactor code. * testsuite/icf_preemptible_functions_test.cc: New file. * testsuite/icf_preemptible_functions_test.sh: New file. * testsuite/icf_string_merge_test.cc: New file. * testsuite/icf_string_merge_test.sh: New file. * testsuite/icf_virtual_function_folding_test.cc: New file. * testsuite/icf_virtual_function_folding_test.sh: New file.
2010-01-12 * script.cc (class Lazy_demangler): Recreate--revert part of patchIan Lance Taylor1-19/+21
of 2009-12-30. (Version_script_info::Version_script_info): Initialize globs_, default_version_, default_is_global_, and exact_. Don't initialize globals_ or locals_. (Version_script_info::build_lookup_tables): Build local symbols first. (Version_script_info::unquote): New function. (Version_script_info::add_exact_match): New function. (Version_script_info::build_expression_list_lookup): Remove lookup parameter. Add is_global parameter. Change all callers. Handle wildcard pattern specially. Unquote pattern. Call add_exact_match. (Version_script_info::get_name_to_match): New function. (Version_script_info::get_symbol_version): New function. (Version_script_info::get_symbol_version_helper): Remove. (Version_script_info::check_unmatched_names): Call unquote. * script.h (class Version_script_info): Change get_symbol_version to be non-inline and add is_global parameter; change all callers. Rewrite symbol_is_local. Update declarations. Define struct Version_tree_match, Exact, Globs. Don't define struct Lookup. Remove globals_ and locals_ members. Add exact_, globs_, default_version_, is_global_. (Version_script_info::Glob): Remove pattern, add expression and is_global. Update constructor. Change all callers. * dynobj.cc (Versions::finalize): Mark the version symbol as the default version. (Versions::symbol_section_contents): If a symbol is undefined, or defined in a dynamic object, set the version index to VER_NDX_LOCAL. * symtab.cc (Symbol_table::add_from_relobj): Don't call symbol_is_local. (Symbol_table::add_from_pluginobj): Likewise. * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
2010-01-09 PR 11108Ian Lance Taylor1-4/+10
* symtab.h (class Symbol): Remove fields is_target_special_ and has_plt_offset_. Add field is_defined_in_discarded_section_. (Symbol::is_defined_in_discarded_section): New function. (Symbol::set_is_defined_in_discarded_section): New function. (Symbol::has_plt_offset): Rewrite. (Symbol::set_plt_offset): Verify that new offset is not -1U. * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U. Don't initialize is_target_special_ or has_plt_offset_. Initialize is_defined_in_discarded_section_. (Symbol_table::add_from_relobj): If appropriate, set is_defined_in_discarded_section. * resolve.cc (Symbol::override_base_with_special): Don't test is_target_special_. Change has_plt_offset_ to has_plt_offset(). * target-reloc.h (relocate_section): Do special handling for symbols defined in discarded sections for global symbols as well as local symbols.
2010-01-05 * symtab.cc (Symbol_table::add_from_object): Rename def parameterIan Lance Taylor1-53/+57
to is_default_version. Rename insdef to insdefault. (Symbol_table::add_from_relobj): Rename def to is_default_version and local to is_forced_local. (Symbol_table::add_from_pluginobj): Likewise. (Symbol_table::add_from_dynobj): Likewise. (Symbol_table::define_special_symbol): Rename insdef to insdefault.
2009-12-31 PR 10916Ian Lance Taylor1-1/+2
* symtab.cc (Symbol_table::add_from_relobj): When not exporting symbols from this object, don't change the visibility of an undefined symbol. * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
2009-12-29 * symtab.h (class Symbol_table): Add enum Defined.Ian Lance Taylor1-17/+25
* resolve.cc (Symbol_table::should_override): Add defined parameter. Change all callers. Test whether object is NULL before calling a method on it. (Symbol_table::report_resolve_problem): Add defined parameter. Change all callers. (Symbol_table::should_override_with_special): Likewise. * symtab.cc (Symbol_table::define_in_output_data): Add defined parameter. Change all callers. (Symbol_table::do_define_in_output_data): Likewise. (Symbol_table::define_in_output_segment): Likewise. (Symbol_table::do_define_in_output_segment): Likewise. (Symbol_table::define_as_constant): Likewise. (Symbol_table::do_define_as_constant): Likewise. * script.h (class Symbol_assignment): Add is_defsym parameter to constructor; change all callers. * script.cc (Script_options::add_symbol_assignment): Add is_defsym parameter. Change all callers. Add is_defsym_ field. (class Parser_closure): Add parsing_defsym parameter to constructor; change all callers. Add parsing_defsym accessor function. Add parsing_defsym_ field.
2009-12-172009-12-16 Doug Kwan <dougkwan@google.com>Doug Kwan1-3/+8
* arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated sections. * object.cc (Sized_relobj::do_finalize_local_symbols): Handle relaxed input sections. * output.cc (Output_section::find_relaxed_input_section): Change return type to Output_relaxed_input_section pointer. Adjust code for new type of relaxed_input_section_map_. * output.h (Output_section::find_relaxed_input_section): Change return type to Output_relaxed_input_section pointer. (Output_section::Output_relaxed_input_section_by_input_section_map): New type. (Output_section::relaxed_input_section_map_): Change type to Output_section::Output_relaxed_input_section_by_input_section_map. * symtab.cc (Symbol_table::compute_final_value): Handle relaxed input section.
2009-12-14 Revert -Wshadow changes, all changes from:Ian Lance Taylor1-322/+322
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 Clifton1-322/+322
Fix up all warnings generated by the addition of this switch.
2009-12-072009-12-07 H.J. Lu <hongjiu.lu@intel.com>H.J. Lu1-2/+7
PR gold/10893 * i386.cc (Target_i386::Scan::globa): Use is_func instead of checking elfcpp::STT_FUNC. (Target_i386::Relocate::relocate): Likewise. * x86_64.cc (Target_x86_64::Scan::global): Likewise. * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC symbols from shared libraries into normal FUNC symbols. * symtab.h (Symbol): Add is_func and use it.
2009-12-052009-12-04 H.J. Lu <hongjiu.lu@intel.com>H.J. Lu1-0/+1
* resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL. (Symbol_table::override_with_special): Likewise. (Symbol_table::add_from_object): Likewise.
2009-11-05 PR 10880Ian Lance Taylor1-0/+6
* object.h (class Object): Add is_needed and set_is_needed methods. Add is_needed_ field. Make bool fields into bitfields. * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is defined in a dynamic object and referenced by a regular object, set is_needed for the dynamic object. * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED if the file is marked with as_needed and it is not needed.
2009-10-28 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.Cary Coutant1-1/+2
* testsuite/Makefile.am (plugin_test_5): New test case. * testsuite/Makefile.in: Regenerate.
2009-10-14 Add support for -pie.Ian Lance Taylor1-1/+2
* options.h (class General_options): Add -pie and --pic-executable. (General_options::output_is_position_independent): Test -pie. (General_options::output_is_executable): Return true if not shared and not relocatable. (General_options::output_is_pie): Remove. * options.cc (General_options::finalize): Reject incompatible uses of -pie. * gold.cc (queue_middle_tasks): A -pie link is not static. * symtab.h (Symbol::needs_plt_entry): Return false if -pie. * symtab.cc (Symbol::final_value_is_known): Return false if output_is_position_independent. * layout.cc (Layout::set_segment_offsets): Start at address 0 if output_is_position_independent. * output.cc (Output_file_header::do_sized_write): Use ET_DYN if output_is_position_independent. * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if output_is_position_independent. * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and two_file_pie_test. (basic_pie_test.o, basic_pie_test): New targets. (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets. (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets. (two_file_pie_test): New target. * testsuite/Makefile.in: Rebuild. * README: Remove note saying that -pie is not supported.
2009-10-13 * gc.h (gc_process_relocs): Check if icf is enabled using newSriraman Tallam1-1/+1
function. * gold.cc (queue_initial_tasks): Likewise. (queue_middle_tasks): Likewise. * object.cc (do_layout): Likewise. * symtab.cc (is_section_folded): Likewise. * main.cc (main): Likewise. * reloc.cc (Read_relocs::run): Likewise. (Sized_relobj::do_scan_relocs): Likewise. * icf.cc (is_function_ctor_or_dtor): New function. (Icf::find_identical_sections): Check if function is ctor or dtor when safe icf is chosen. * options.h (General_options::icf): Change option to be an enum. (Icf_status): New enum. (icf_enabled): New method. (icf_safe_folding): New method. (set_icf_status): New method. (icf_status_): New variable. * (options.cc) (General_options::finalize): Set icf_status_. * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify icf_test and icf_keep_unique_test to use the --icf enum flag. * testsuite/icf_safe_test.sh: New file. * testsuite/icf_safe_test.cc: New file.
2009-10-092009-10-09 Doug Kwan <dougkwan@google.com>Doug Kwan1-25/+62
* layout.cc (Layout::make_output_section): Call target hook to make ordinary output section. (Layout::finalize): Adjust parameter list of call the Target::may_relax(). * layout.h (class Layout::section_list): New method. * merge.h (Output_merge_base::entsize): Change visibility to public. (Output_merge_base::is_string, Output_merge_base::do_is_string): New methods. (Output_merge_string::do_is_string): New method. * object.cc (Sized_relobj::do_setup): renamed from Sized_relobj::set_up. * object.h (Sized_relobj::adjust_shndx, Sized_relobj::initializ_input_to_output_maps, Sized_relobj::free_input_to_output_maps): Change visibilities to protected. (Sized_relobj::setup): Virtualize. (Sized_relobj::do_setup): New method declaration. (Sized_relobj::invalidate_section_offset, Sized_relobj::do_invalidate_section_offset): New method decfinitions. (Sized_relobj::elf_file, Sized_relobj::local_values): New methods. * options.cc (parse_int): New function. * options.h (parse_int): New declaration. (DEFINE_int): New macro. (stub_group_size): New option. * output.cc (Output_section::Output_section): Initialize memebers merge_section_map_, merge_section_by_properties_map_, relaxed_input_section_map_, is_relaxed_input_section_map_valid_. (Output_section::add_input_section): Handled deferred code-fill generation and remove an old comment. (Output_section::add_relaxed_input_section): New method definition. (Output_section::add_merge_input_section): Use merge section by properties map to speed to search. Update merge section maps as appropriate. (Output_section::build_relaxation_map): New method definition. (Output_section::convert_input_sections_in_list_to_relaxed_sections): Same. (Output_section::relax_input_section): Renamed to Output_section::convert_input_sections_to_relaxed_sections and change interface to take a vector of pointers to relaxed sections. (Output_section::find_merge_section, Output_section::find_relaxed_input_section): New method definitions. (Output_section::is_input_address_mapped, Output_section::output_offset, Output_section::output_address): Use output section data maps to speed up searching. (Output_section::find_starting_output_address): Add comments. (Output_section::do_write, Output_section::write_to_postprocessing_buffer): Do code-fill generation as appropriate. (Output_section::get_input_sections): Invalidate relaxed input section map. (Output_section::restore_states): Adjust type of checkpoint . Invalidate relaxed input section map. * output.h (Output_merge_base): New class declaration. (Input_section_specifier): New class defintion. (class Output_relaxed_input_section) Change base class to Output_section_data_build. (Output_relaxed_input_section::Output_relaxed_input_section): Adjust base class initializer. (Output_section::add_relaxed_input_section): New method declaration. (Output_section::Input_section): Change visibility to protected. (Output_section::Input_section::relobj, Output_section::Input_section::shndx): Handle relaxed input sections. Output_section::input_sections) Change visibility to protected. Also define overload to return a non-const pointer. (Output_section::Merge_section_properties): New class defintion. (Output_section::Merge_section_by_properties_map, Output_section::Output_section_data_by_input_section_map, Output_section::Relaxation_map): New types. (Output_section::relax_input_section): Rename method to Output_section::convert_input_sections_to_relaxed_sections and change interface to take a vector of relaxed section pointers. (Output_section::find_merge_section, Output_section::find_relaxed_input_section, Output_section::build_relaxation_map, Output_section::convert_input_sections_in_list_to_relaxed_sections): New method declarations. (Output_section::merge_section_map_ Output_section::merge_section_by_properties_map_, Output_section::relaxed_input_section_map_, Output_section::is_relaxed_input_section_map_valid_, Output_section::generate_code_fills_at_write_): New data members. * script-sections.cc (Output_section_element_input::set_section_addresses): Call current_data_size and addralign methods of relaxed input sections. (Orphan_output_section::set_section_addresses): Call current_data_size and addralign methods of relaxed input sections. * symtab.cc (Symbol_table::compute_final_value): Extract template from the body of Symbol_table::sized_finalize_symbol. (Symbol_table::sized_finalized_symbol): Call Symbol_table::compute_final_value. * symtab.h (Symbol_table::Compute_final_value_status): New enum type. (Symbol_table::compute_final_value): New templated method declaration. * target.cc (Target::do_make_output_section): New method defintion. * target.h (Target::make_output_section): New method declaration. (Target::relax): Add more parameters for input objects, symbol table and layout. Adjust call to do_relax. (Target::do_make_output_section): New method declaration. (Target::do_relax): Add parameters for input objects, symbol table and layout.
2009-09-30 * object.h (class Object): Remove target_ field, and target,Ian Lance Taylor1-12/+6
sized_target, and set_target methods. (Object::sized_target): Remove. (class Sized_relobj): Update declarations. Remove sized_target. * object.cc (Sized_relobj::setup): Remove target parameter. Change all callers. (Input_objects::add_object): Don't do anything with the target. (make_elf_sized_object): Add punconfigured parameter. Change all callers. Set or test parameter target. * dynobj.cc (Sized_dynobj::target): Remove target parameter. Change all callers. * parameters.cc (Parameters::set_target): Change parameter type to be non-const. (Parameters::default_target): Remove. (set_parameters_target): Change parameter type to be non-const. (parameters_force_valid_target): New function. (parameters_clear_target): New function. * parameters.h (class Parameters): Update declarations. Remove default_target method. Add sized_target and clear_target methods. Change target_ to be non-const. (set_parameters_target): Update declaration. (parameters_force_valid_target): Declare. (parameters_clear_target): Declare. * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured as NULL if we aren't searching. (Add_symbols::run): Don't check for compatible target. * fileread.cc (Input_file::open_binary): Call parameters_force_valid_target. * gold.cc (queue_middle_tasks): Likewise. * plugin.cc (make_sized_plugin_object): Likewise. Don't call set_target on object. * dynobj.h (class Sized_dynobj): Update declarations. * archive.cc (Archive::get_elf_object_for_member): Return NULL if make_elf_object returns NULL. (Archive::include_member): Don't check whether object target is compatible. * output.cc (Output_section::add_input_section): Get target from parameters. (Output_section::relax_input_section): Likewise. * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from parameters. (Sized_relobj::do_scan_relocs): Likewise. (Sized_relobj::relocate_sections): Likewise. * resolve.cc (Symbol_table::resolve): Likewise. * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object parameter. Change all callers. (Symbol_table::add_from_object): Get target from parameters. (Symbol_table::add_from_relobj): Don't check object target. (Symbol_table::add_from_dynobj): Likewise. (Symbol_table::define_special_symbol): Get target from parameters. * symtab.h (class Symbol_table): Update declaration. * testsuite/binary_unittest.cc (gold_testsuite): Remove target parameter. Change all callers. Clear parameter target. (Binary_test): Test target here. * testsuite/object_unittest.cc (gold_testsuite): Remove target_test_pointer parameter. Change all callers. (Object_test): Test target here.
2009-09-18 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.Craig Silverstein1-1/+2
* options.cc: Include <cerrno> and <fstream>. (General_options::finalize): Parse -retain-symbols-file tag. * options.h: New flag. (General_options): New method should_retain_symbol, new variable symbols_to_retain. * symtab.cc (Symbol_table::sized_finalize_symbol): Test should_retain_symbol map. * testsuite/Makefile.am (retain_symbols_file_test): New test. * testsuite/Makefile.in: Regenerate. * testsuite/retain_symbols_file_test.sh: New file.