summaryrefslogtreecommitdiff
path: root/gold/object.cc
Commit message (Collapse)AuthorAgeFilesLines
* Support building gold with gcc 4.2/4.3.H.J. Lu2010-09-091-1/+1
| | | | | | | | | | 2010-09-09 H.J. Lu <hongjiu.lu@intel.com> PR gold/11996 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove "This::" to work around a bug in gcc 4.2. * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
* 2010-09-08 Doug Kwan <dougkwan@google.com>Doug Kwan2010-09-081-127/+189
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method. (Arm_relobj::do_relocate_sections): Add new parameter for output file to match the parent. (Target_arm::scan_reloc_section_for_stubs): Use would-be final values of local symbols instead of input values. Update code to track changes in gold::relocate_section. * object.cc (Sized_relobj::compute_final_local_value): New methods. (Sized_relobj::compute_final_local_value_internal): New methods. (Sized_relobj::do_finalize_local_symbols): Move code from loop body into private version of Sized_relobj::compute_final_local_value. Call the inline method. * object.h (Symbol_value::Symbol_value): Define destructor. Free merged symbol value if there is one. (Symbol_value::has_output_value): New method defintiion. (Sized_relobj::Compute_final_local_value_status): New enum type. (Sized_relobj::compute_final_local_value): New methods. (Sized_relobj::compute_final_local_value_internal): New methods. * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh and arm_cortex_a8.sh. (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl, arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc): New tests. * Makefile.in: Regenerate. * testsuite/arm_bl_out_of_range.s: Update test. * testsuite/thumb_bl_out_of_range.s: Ditto. * testsuite/thumb_blx_out_of_range.s: Ditto. * testsuite/arm_branch_out_of_range.sh: New file. * testsuite/arm_cortex_a8.sh: Ditto. * testsuite/arm_cortex_a8_b.s: Ditto. * testsuite/arm_cortex_a8_b_cond.s: Ditto. * testsuite/arm_cortex_a8_b_local.s: Ditto. * testsuite/arm_cortex_a8_bl.s: Ditto. * testsuite/arm_cortex_a8_blx.s: Ditto. * testsuite/arm_cortex_a8_local.s: Ditto. * testsuite/arm_cortex_a8_local_reloc.s: Ditto. * testsuite/thumb_bl_out_of_range_local.s: Ditto.
* * archive.cc: Formatting fixes: Remove whitespace betweenNick Clifton2010-08-251-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* PR 10893Ian Lance Taylor2010-08-191-1/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * i386.cc (class Output_data_plt_i386): Update declarations. Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and local_ifuncs_ fields. (Target_i386::do_plt_section_for_global): New function. (Target_i386::do_plt_section_for_local): New function. (Output_data_plt_i386::Output_data_plt_i386): Add symtab parameter; change all callers. Initialize global_ifuncs_ and local_ifuncs_. If doing a static link define __rel_iplt_start and __rel_iplt_end. (Output_data_plt_i386::add_entry): Handle IFUNC symbols. (Output_data_plt_i386::add_local_ifunc_entry): New function. (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC symbols. (Target_i386::make_plt_section): New function, broken out of make_plt_entry. Set sh_info field of .rel.plt to point to .plt. (Target_i386::make_plt_entry): Call make_plt_section. (Target_i386::make_local_ifunc_plt_entry): New function. (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function. (Target_i386::Scan::local): Handle IFUNC symbols. Add R_386_IRELATIVE to switch. (Target_i386::Scan::global): Likewise. (Target_i386::Relocate::relocate): Likewise. (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to switch. * x86_64.cc (class Output_data_plt_x86_64): Update declarations. (Target_x86_64::do_plt_section_for_global): New function. (Target_x86_64::do_plt_section_for_local): New function. (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab parameter; change all callers. If doing a static link define __rela_iplt_start and __rela_iplt_end. (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols. (Output_data_plt_x86_64::add_local_ifunc_entry): New function. (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt to point to .plt. (Target_x86_64::make_local_ifunc_plt_entry): New function. (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to switch. (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function. (Target_x86_64::Scan::local): Handle IFUNC symbols. Add R_X86_64_IRELATIVE to switch. (Target_x86_64::Scan::global): Likewise. (Target_x86_64::Relocate::relocate): Likewise. (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to switch. * target.h (class Target): Add plt_section_for_global and plt_section_for_local functions. Add do_plt_section_for_global and do_plt_section_for_local virtual functions. * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add clarifying comments. (Symbol::use_plt_offset): Handle IFUNC symbol. * object.cc (Sized_relobj::Sized_relobj): Initialize local_plt_offsets_. (Sized_relobj::local_has_plt_offset): New function. (Sized_relobj::local_plt_offset): New function. (Sized_relobj::set_local_plt_offset): New function. (Sized_relobj::do_count): Handle IFUNC symbol. * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take a bit away from input_shndx_ field. Add set_is_func_symbol and is_ifunc_symbol functions. (class Sized_relobj): Update declarations. Remove Tls_got_entry and Local_tls_got_offsets. Define Local_plt_offsets. Add local_plt_offsets_ field. (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_. * output.h (class Output_section_data): Add non-const output_section function. (class Output_data_got): Update declarations. (class Output_data_got::Got_entry): Add use_plt_offset_ field. Add use_plt_offset parameter to global and local constructors. Change all callers. Change local_sym_index_ field to 31 bits. Change GSYM_CODE and CONSTANT_CODE accordingly. * output.cc (Output_data_reloc_base::do_adjust_output_section): If doing a static link don't set sh_link field. (Output_data_got::Got_entry::write): Use PLT offset if appropriate. (Output_data_got::add_global_plt): New function. (Output_data_got::add_local_plt): New function. * target-reloc.h (relocate_section): Handle IFUNC symbol. * defstd.cc (in_section): Remove entries for __rel_iplt_start, __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end. * configure.ac: Set IFUNC automake conditional for glibc >= 2.11. * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within IFUNC conditional. * testsuite/ifunc-sel.h: New file. * testsuite/ifuncmain1.c: New file. * testsuite/ifuncmain1vis.c: New file. * testsuite/ifuncmod1.c: New file. * testsuite/ifuncdep2.c: New file. * testsuite/ifuncmain2.c: New file. * testsuite/ifuncmain3.c: New file. * testsuite/ifuncmod3.c: New file. * testsuite/ifuncmain4.c: New file. * testsuite/ifuncmain5.c: New file. * testsuite/ifuncmod5.c: New file. * testsuite/ifuncmain6pie.c: New file. * testsuite/ifuncmod6.c: New file. * testsuite/ifuncmain7.c: New file. * configure, testsuite/Makefile.in: Rebuild.
* elfcpp/ChangeLog:Cary Coutant2010-08-121-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * elfcpp.h (enum SHT): Add SHT_GNU_INCREMENTAL_SYMTAB, SHT_GNU_INCREMENTAL_RELOCS. gold/ChangeLog: * archive.cc: Include incremental.h. (Archive::Archive): Initialize incremental_info_. (Archive::include_member): Record archive members in incremental info. (Add_archive_symbols::run): Record begin and end of an archive in incremental info. (Lib_group::include_member): Record objects in incremental info. * archive.h (Incremental_archive_entry): Forward declaration. (Archive::set_incremental_info): New member function. (Archive::incremental_info): New member function. (Archive::Unused_symbol_iterator): New class. (Archive::unused_symbols_begin): New member function. (Archive::unused_symbols_end): New member function. (Archive::incremental_info_): New data member. * incremental-dump.cc (find_input_containing_global): New function. (dump_incremental_inputs): Dump new incremental info sections. * incremental.cc: Include symtab.h. (Output_section_incremental_inputs): New class. (Sized_incremental_binary::do_find_incremental_inputs_sections): Support new incremental info sections. (Sized_incremental_binary::do_check_inputs): Likewise. (Incremental_inputs::report_archive): Remove. (Incremental_inputs::report_archive_begin): New function. (Incremental_inputs::report_archive_end): New function. (Incremental_inputs::report_object): New function. (Incremental_inputs::finalize_inputs): Remove. (Incremental_inputs::report_input_section): New function. (Incremental_inputs::report_script): Rewrite. (Incremental_inputs::finalize): Do nothing but finalize string table. (Incremental_inputs::create_incremental_inputs_section_data): Remove. (Incremental_inputs::sized_create_inputs_section_data): Remove. (Incremental_inputs::create_data_sections): New function. (Incremental_inputs::relocs_entsize): New function. (Output_section_incremental_inputs::set_final_data_size): New function. (Output_section_incremental_inputs::do_write): New function. (Output_section_incremental_inputs::write_header): New function. (Output_section_incremental_inputs::write_input_files): New function. (Output_section_incremental_inputs::write_info_blocks): New function. (Output_section_incremental_inputs::write_symtab): New function. * incremental.h (Incremental_script_entry): Forward declaration. (Incremental_object_entry): Forward declaration. (Incremental_archive_entry): Forward declaration. (Incremental_inputs): Forward declaration. (Incremental_inputs_header_data): Remove. (Incremental_inputs_header): Remove. (Incremental_inputs_header_write): Remove. (Incremental_inputs_entry_data): Remove. (Incremental_inputs_entry): Remove. (Incremental_inputs_entry_write): Remove. (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER. (Incremental_binary::find_incremental_inputs_sections): Add parameters. (Incremental_binary::do_find_incremental_inputs_sections): Likewise. (Sized_ncremental_binary::do_find_incremental_inputs_sections): Likewise. (Incremental_input_entry): New class. (Incremental_script_entry): New class. (Incremental_object_entry): New class. (Incremental_archive_entry): New class. (Incremental_inputs::Incremental_inputs): Initialize new data members. (Incremental_inputs::report_inputs): Remove. (Incremental_inputs::report_archive): Remove. (Incremental_inputs::report_archive_begin): New function. (Incremental_inputs::report_archive_end): New function. (Incremental_inputs::report_object): Change prototype. (Incremental_inputs::report_input_section): New function. (Incremental_inputs::report_script): Change prototype. (Incremental_inputs::get_reloc_count): New function. (Incremental_inputs::set_reloc_count): New function. (Incremental_inputs::create_data_sections): New function. (Incremental_inputs::create_incremental_inputs_section_data): Remove. (Incremental_inputs::inputs_section): New function. (Incremental_inputs::symtab_section): New function. (Incremental_inputs::relocs_section): New function. (Incremental_inputs::get_stringpool): Add const. (Incremental_inputs::command_line): Add const. (Incremental_inputs::inputs): Remove. (Incremental_inputs::command_line_key): New function. (Incremental_inputs::input_file_count): New function. (Incremental_inputs::input_files): New function. (Incremental_inputs::relocs_entsize): New function. (Incremental_inputs::sized_create_inputs_section_data): Remove. (Incremental_inputs::finalize_inputs): Remove. (Incremental_inputs::Input_info): Remove. (Incremental_inputs::lock_): Remove. (Incremental_inputs::inputs_): Change type. (Incremental_inputs::inputs_map_): Remove. (Incremental_inputs::current_object_entry_): New data member. (Incremental_inputs::inputs_section_): New data member. (Incremental_inputs::symtab_section_): New data member. (Incremental_inputs::relocs_section_): New data member. (Incremental_inputs::reloc_count_): New data member. (Incremental_inputs_reader): New class. (Incremental_symtab_reader): New class. (Incremental_relocs_reader): New class. * layout.cc (Layout::finalize): Move finalization of incremental info and creation of incremental info sections to follow finalization of symbol table. Set offsets for postprocessing sections. (Layout::create_incremental_info_sections): Call Incremental_inputs::create_data_sections. Add incremental symtab and relocs sections. Set sh_entsize and sh_link fields. Arrange for sections to layout after input sections. * layout.h (struct Timespec): Forward declaration. (Layout::incremental_inputs): Add const. (Layout::create_incremental_info_sections): Add parameter. * main.cc (main): Remove call to Incremental_inputs::report_inputs. * object.cc: Include incremental.h. (Relobj::finalize_incremental_relocs): New function. (Sized_relobj::do_layout): Record input sections in incremental info. * object.h (Object::output_section): New function. (Object::output_section_offset): Moved from Relobj. (Object::get_incremental_reloc_base): New function. (Object::get_incremental_reloc_count): New function. (Object::do_output_section): New function. (Object::do_output_section_offset): Moved from Relobj. (Object::do_get_incremental_reloc_base): New function. (Object::do_get_incremental_reloc_count): New function. (Object::Object): Initialize new data members. (Relobj::output_section): Renamed do_output_section and moved to protected. (Relobj::output_section_offset): Moved to Object. (Relobj::do_get_incremental_reloc_base): New function. (Relobj::do_get_incremental_reloc_count): New function. (Relobj::allocate_incremental_reloc_counts): New function. (Relobj::count_incremental_reloc): New function. (Relobj::finalize_incremental_relocs): New function. (Relobj::next_incremental_reloc_index): New function. (Relobj::reloc_counts_): New data member. (Relobj::reloc_bases_): New data member. (Sized_relobj::do_relocate_sections): Add parameter. Change caller. (Sized_relobj::relocate_sections): Add parameter. Change all callers. (Sized_relobj::incremental_relocs_scan): New function. (Sized_relobj::incremental_relocs_scan_reltype): New function. (Sized_relobj::incremental_relocs_write): New function. (Sized_relobj::incremental_relocs_write_reltype): New function. * plugin.cc (Plugin_manager::add_input_file): Rewrite test for incremental link. * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of archives and object files elsewhere. (Add_symbols::run): Report object files here. (Finish_group::run): Report end of archive at end of group. * reloc.cc: Include layout.h, incremental.h. (Sized_relobj::do_read_relocs): Need relocations for incremental link. (Sized_relobj::do_scan_relocs): Record relocations for incremental link. (Sized_relobj::incremental_relocs_scan): New function. (Sized_relobj::incremental_relocs_scan_reltype): New function. (Sized_relobj::do_relocate_sections): Write incremental relocations. (Sized_relobj::incremental_relocs_write): New function. (Sized_relobj::incremental_relocs_write_reltype): New function. * script.cc (read_input_script): Rewrite test for incremental link. Change call to Incremental_inputs::report_script. * symtab.h (Symbol_table::first_global_index): New function. (Symbol_table::output_count): New function.
* PR 11855Ian Lance Taylor2010-08-021-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* * compressed_output.cc (zlib_decompress): New function.Cary Coutant2010-07-121-1/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (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.
* * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.Cary Coutant2010-06-101-0/+41
| | | | | | | | | | | | | | (Sized_relobj::do_layout_deferred_sections): Do layout for deferred reloc sections. * object.h (Sized_relobj::deferred_layout_relocs_): New data member. PR 11683 * symtab.h (Symbol::is_placeholder): New member function. * target-reloc.h (relocate_section): Check for placeholder symbols. * testsuite/Makefile.am (plugin_test_8): New test. (plugin_test_9): New test. * testsuite/Makefile.in: Regenerate.
* 2010-05-27 Doug Kwan <dougkwan@google.com>Doug Kwan2010-05-261-3/+13
| | | | | | * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset from start of output section instead of address for a local symbol in a merged or relaxed section when doing a relocatable link.
* 2010-05-26 Rafael Espindola <espindola@google.com>espindola2010-05-261-0/+5
| | | | | | | | | | | PR 11604 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid adding sections the garbage collector removed. * gold/testsuite/Makefile.am: Add test. * gold/testsuite/Makefile.in: Regenerate. * gold/testsuite/plugin_test_7.sh: New. * gold/testsuite/plugin_test_7_1.c: New. * gold/testsuite/plugin_test_7_2.c: New.
* * archive.cc (include_member): Destroy Read_symbols_data object beforeCary Coutant2010-04-071-0/+22
| | | | | | | | | | | | | releasing file. * object.cc (Read_symbols_data::~Read_symbols_data) New destructor. * object.h (Read_symbols_data::Read_symbols_data) New constructor. (Read_symbols_data::~Read_symbols_data) New destructor. (Section_relocs::Section_relocs) New constructor. (Section_relocs::~Section_relocs) New destructor. (Read_relocs_data::Read_relocs_data) New constructor. (Read_relocs_data::~Read_relocs_data) New destructor. * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member pointers to NULL after deleting.
* 2010-03-22 Rafael Espindola <espindola@google.com>espindola2010-03-221-0/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * archive.cc (Should_include): Move to archive.h. (should_include_member): Make it a member of Archive. (Lib_group): New. (Add_lib_group_symbols): New. * archive.h: Include options.h. (Archive_member): Moved from Archive. (Should_include): Moved from archive.cc. (Lib_group): New. (Add_lib_group_symbols): New. * dynobj.cc (do_should_include_member): New. * dynobj.h (do_should_include_member): New. * gold.cc (queue_initial_tasks): Update call to queue. * main.cc (main): Print lib group stats. * object.cc (do_should_include_member): New. * object.h: Include archive.h. (Object::should_include_member): New. (Object::do_should_include_member): New. (Sized_relobj::do_should_include_member): New. * options.cc (General_options::parse_start_lib): New. (General_options::parse_end_lib): New. (Input_arguments::add_file): Handle lib groups. (Input_arguments::start_group): Check we are not in a lib. (Input_arguments::start_lib): New. (Input_arguments::end_lib): New. * options.h (General_options): Add start_lib and end_lib. (Input_argument::lib_): New. (Input_argument::lib): New. (Input_argument::is_lib): New. (Input_file_lib): New. (Input_arguments::in_lib_): New. (Input_arguments::in_lib): New. (Input_arguments::start_lib): New. (Input_arguments::end_lib_): New. * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols in unused members as preempted. (Sized_pluginobj::do_should_include_member): New. * plugin.h (Sized_pluginobj::do_should_include_member): New. * readsyms.cc (Read_symbols::locks): If we are just reading a member, return the blocker. (Read_symbols::do_whole_lib_group): New. (Read_symbols::do_lib_group): New. (Read_symbols::do_read_symbols): Handle lib groups. (Read_symbols::get_name): Handle lib groups. * readsyms.h (Read_symbols): Add an archive member pointer. (Read_symbols::do_whole_lib_group): New. (Read_symbols::do_lib_group): New. (Read_symbols::member_): New. * script.cc (read_input_script): Update call to queue_soon.
* * target-reloc.h (relocate_section): Check the symbol table indexIan Lance Taylor2010-03-031-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | for -1U before setting the local symbol index. (scan_relocatable_relocs): If copying the relocation, record that the local symbol is required. * object.h (Symbol_value::is_output_symtab_index_set): New function. (Symbol_value::may_be_discarded_from_output_symtab): New function. (Symbol_value::has_output_symtab_entry): New function. (Symbol_value::needs_output_symtab_entry): Remove. (Symbol_value::output_symtab_index): Make sure the symbol index is set. (Symbol_value::set_output_symtab_index): Make sure the symbol index is not set. Make sure the new index is valid. (Symbol_value::set_must_have_output_symtab_entry): New function. (Symbol_value::has_output_dynsym_entry): New function. (Symbol_value::set_output_dynsym_index): Make sure the new index is valid. (Sized_relobj::set_must_have_output_symtab_entry): New function. * object.cc (Sized_relobj::do_count_local_symbols): Only discard a local symbol if permitted. (Sized_relobj::do_finalize_local_symbols): Call is_output_symtab_index_set rather than needs_output_symtab_entry. (Sized_relobj::write_local_symbols): Call has_output_symtab_entry rather than needs_output_symtab_entry. Call has_output_dynsym_entry rather than needs_output_dynsym_entry. * arm.cc (Arm_relobj::update_output_local_symbol_count): Call is_output_symtab_index_set rather than needs_output_symtab_entry. * testsuite/discard_locals_relocatable_test.c: New file. * testsuite/discard_locals_test.sh: Test -r. * testsuite/Makefile.am (check_DATA): Add discard_locals_relocatable_test1.syms, discard_local_relocatable_test2.syms. (MOSTLYCLEANFILES): Likewise. Also add discard_locals_relocatable_test1.lout and discard_locals_relocatable_test2.out. (discard_locals_relocatable_test1.syms): New target. (discard_locals_relocatable_test.o): New target. (discard_locals_relocatable_test1.out): New target. (discard_locals_relocatable_test2.syms): New target. (discard_locals_relocatable_test2.out): New target. (various): Add missing ../ld-new dependencies. * testsuite/Makefile.in: Rebuild.
* Fix comment.Ian Lance Taylor2010-02-111-3/+3
|
* * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stackSriraman Tallam2010-01-151-1/+1
| | | | in the first pass of do_layout.
* * object.cc (Sized_relobj::do_layout): Don't get confused ifIan Lance Taylor2010-01-081-2/+2
| | | | layout_eh_frame returns NULL.
* PR 11019Ian Lance Taylor2010-01-071-0/+44
| | | | | * object.cc: Instantiate Xindex::initialize_symtab_xindex and Xindex::read_symtab_xindex.
* * gc.h (Garbage_collection::Cident_section_map): New typedef.Sriraman Tallam2010-01-071-0/+8
| | | | | | | | | | | | | | | | | | | (Garbage_collection::cident_sections): New function. (Garbage_collection::add_cident_section): New function. (Garbage_collection::cident_sections_): New member. (gc_process_relocs): Add references to sections whose names are C identifiers. * gold.h (cident_section_start_prefix): New constant. (cident_section_stop_prefix): New constant. (is_cident): New function. * layout.cc (Layout::define_section_symbols): Replace string constants with the newly defined constants. * object.cc (Sized_relobj::do_layout): Track sections whose names are C identifiers. * testsuite/Makefile.am: Add gc_orphan_section_test. * testsuite/Makefile.in: Regenerate. * testsuite/gc_orphan_section_test.cc: New file. * testsuite/gc_orphan_section_test.sh: New file.
* PR 10980Ian Lance Taylor2010-01-051-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * options.h (class General_options): Add --cref. * main.cc (main): Print cref table if --cref. Don't close mapfile until after printing cref table. * cref.cc: Include "symtab.h". (class Cref_inputs): Define Cref_table_compare and Cref_table. (Cref_table_compare::operator()): New function. (Cref_inputs::gather_cref): New function. (filecol): New static const. (Cref_inputs::print_cref): New function. (Cref::print_cref): New function. * cref.h: Include <cstdio>. (class Cref): Update declarations. * mapfile.h (Mapfile::file): New function. * object.h (class Object): Define Symbols. Declare virtual do_get_global_symbols. (Object::get_global_symbols): New function. * object.cc (Input_objects::add_object): Pass object to cref_ if --cref. (Input_objects::archive_start): Likewise. (Input_objects::archive_stop): Likewise. (Input_objects::print_cref): New function. * dynobj.h (Sized_dynobj::do_get_global_symbols): New function. * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if --cref. * plugin.cc (Sized_pluginobj::do_get_global_symbols): New function. * plugin.h (class Sized_pluginobj): Update declarations.
* PR 10980Ian Lance Taylor2010-01-051-3/+22
| | | | | | | | * options.h (class General_options): Add --add-needed and --copy-dt-needed-entries. Tweak --as-needed help entry. * object.cc (Input_objects::check_dynamic_dependencies): Give an error if --copy-dt-needed-entries aka --add-needed is used and would cause a change in behaviour.
* PR 10670Ian Lance Taylor2009-12-301-9/+17
| | | | | | | * options.h (class General_options): Add -x/--discard-all. * object.cc (Sized_relobj::do_count_local_symbols): Handle --discard-all. If the local symbol needs a dynamic entry, check that before handling --discard-locals.
* * object.cc (Relobj::is_section_name_included): Fix formatting.Ian Lance Taylor2009-12-291-2/+2
|
* 2009-12-16 Doug Kwan <dougkwan@google.com>Doug Kwan2009-12-171-1/+9
| | | | | | | | | | | | | | | | | | * 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.
* Revert -Wshadow changes, all changes from:Ian Lance Taylor2009-12-141-158/+158
| | | | | | 2009-12-11 Doug Kwan <dougkwan@google.com> 2009-12-11 Nick Clifton <nickc@redhat.com> * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
* Add -Wshadow to the gcc command line options used when compiling the binutils.Nick Clifton2009-12-111-158/+158
| | | | Fix up all warnings generated by the addition of this switch.
* 2009-12-05 Doug Kwan <dougkwan@google.com>Doug Kwan2009-12-061-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | elfcpp/ChangeLog: * arm.h: Define enums for Tag_CPU_arch EABI attribute. gold/ChangeLog: * arm.cc (Target_arm::arm_info): Initialize new fields attributes_section and attributes_vendor. * i386.cc (Target_i386::i386_info): Same. * object.cc (Sized_relobj::do_layout): Skip attribute section. * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new fields attributes_section and attributes_vendor. * sparc.cc (Target_sparc::sparc_info): Same. * target.h (Target::attributes_section, Target::attributes_vendor, Target::is_attributes_section, Target::attribute_arg_type, Target::attributes_order): New method definitions. (Target::Target_info::attributes_section, Target::Target_info::attributes_vendor): New fields. (Target::do_attribute_arg_type, Target::do_attributes_order): New virtual method definitions. * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields attributes_section and attributes_vendor. * testsuite/testfile.cc (Target_test::test_target_info): Same.
* 2009-11-10 Doug Kwan <dougkwan@google.com>Doug Kwan2009-11-091-2/+2
| | | | | | | | | | * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid a format warning. * incremental.cc (open_incremental_binary): Initialized local variables to avoid warnings. * object.cc (make_elf_object): Ditto. * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid a format warning.
* 2009-10-20 Doug Kwan <dougkwan@google.com>Doug Kwan2009-10-211-6/+12
| | | | | | | * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section symbols of relaxed input sections. * output.h (Output_section::find_relaxed_input_section): Make method public.
* * gc.h (gc_process_relocs): Check if icf is enabled using newSriraman Tallam2009-10-131-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | 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-09 Doug Kwan <dougkwan@google.com>Doug Kwan2009-10-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* elfcpp/:Ian Lance Taylor2009-10-091-62/+12
| | | | | | | | | | | | | | | | | | | | | | | | | * elfcpp_file.h: Fix header guard. Include <cstdio>. (class Elf_recognizer): New class, code from gold/object.cc. (Elf_file::find_section_by_type): New method. gold/: * incremental.cc: Include <cstdarg> and "target-select.h". (vexplain_no_incremental): New function. (explain_no_incremental): New function. (Incremental_binary::error): New method. (Sized_incremental_binary::do_find_incremental_inputs_section): New method. (make_sized_incremental_binary): New function. (open_incremental_binary): New function. (can_incrementally_link_file): Add checks if output is ELF and has inputs section. * incremental.h: Include "elfcpp_file.h" and "output.h". (Incremental_binary): New class. (Sized_incremental_binary): New class. (open_incremental_binary): Declare. * object.cc (is_elf_object): Use elfcpp::Elf_recognizer::is_elf_file. (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header. * output.h (Output_file::filesize): New method.
* * options.h (class General_options): DefineIan Lance Taylor2009-10-061-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | split_stack_adjust_size parameter. * object.h (class Object): Add uses_split_stack_ and has_no_split_stack_ fields. Add uses_split_stack and has_no_split_stack accessor functions. Declare handle_split_stack_section. (class Reloc_symbol_changes): Define. (class Sized_relobj): Define Function_offsets. Declare split_stack_adjust, split_stack_adjust_reltype, and find_functions. * object.cc (Object::handle_split_stack_section): New function. (Sized_relobj::do_layout): Call handle_split_stack_section. * dynobj.cc (Sized_dynobj::do_layout): Call handle_split_stack_section. * reloc.cc (Sized_relobj::relocate_sections): Call split_stack_adjust for executable sections in split_stack objects. Pass reloc_map to relocate_section. (Sized_relobj::split_stack_adjust): New function. (Sized_relobj::split_stack_adjust_reltype): New function. (Sized_relobj::find_functions): New function. * target-reloc.h: Include "object.h". (relocate_section): Add reloc_symbol_changes parameter. Change all callers. * target.h (class Target): Add calls_non_split method. Declare do_calls_non_split virtual method. Declare match_view and set_view_to_nop. * target.cc: Include "elfcpp.h". (Target::do_calls_non_split): New function. (Target::match_view): New function. (Target::set_view_to_nop): New function. * gold.cc (queue_middle_tasks): Give an error if mixing split-stack and non-split-stack objects with -r. * i386.cc (Target_i386::relocate_section): Add reloc_symbol_changes parameter. (Target_i386::do_calls_non_split): New function. * x86_64.cc (Target_x86_64::relocate_section): Add reloc_symbol_changes parameter. (Target_x86_64::do_calls_non_split): New function. * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes parameter. * powerpc.cc (Target_powerpc::relocate_section): Add reloc_symbol_changes parameter. * sparc.cc (Target_sparc::relocate_section): Add reloc_symbol_changes parameter. * configure.ac: Call AM_CONDITIONAL for the default target. * configure: Rebuild. * testsuite/Makefile.am (TEST_AS): New variable. (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh. (check_DATA): Add split_i386 and split_x86_64 files. (SPLIT_DEFSYMS): Define. (split_i386_[1234n].o): New targets. (split_i386_[124]): New targets. (split_i386_[1234r].stdout): New targets. (split_x86_64_[1234n].o): New targets. (split_x86_64_[124]): New targets. (split_x86_64_[1234r].stdout): New targets. (MOSTLYCLEANFILES): Add new executables. * testsuite/split_i386.sh: New file. * testsuite/split_x86_64.sh: New file. * testsuite/split_i386_1.s: New file. * testsuite/split_i386_2.s: New file. * testsuite/split_i386_3.s: New file. * testsuite/split_i386_4.s: New file. * testsuite/split_i386_n.s: New file. * testsuite/split_x86_64_1.s: New file. * testsuite/split_x86_64_2.s: New file. * testsuite/split_x86_64_3.s: New file. * testsuite/split_x86_64_4.s: New file. * testsuite/split_x86_64_n.s: New file. * testsuite/testfile.cc (Target_test): Update relocation_section function. * testsuite/Makefile.in: Rebuild.
* * object.h (class Object): Remove target_ field, and target,Ian Lance Taylor2009-09-301-19/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.Craig Silverstein2009-09-181-0/+8
| | | | | | | | | | | | | * 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.
* 2009-08-18 Doug Kwan <dougkwan@google.com>Doug Kwan2009-08-181-39/+10
| | | | | | | | | | | | | | | | | | | | | | | * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of an elcpp::Ehdr as parameter. Adjust call to set_target. * dynobj.h (Sized_dynobj::setup): Take a Target object instead of an elfcpp::Ehdr as parameter. * object.cc (Object::set_target): Remove the version that looks up a target and sets it. (Sized_relobj::setup): Take a Target object instead of an elfcpp::Ehdr as parameter. Adjust call to set_target. (make_elf_sized_object): Find target and ask target to make an ELF object. * object.h: (Object::set_target): Remove the version that looks up a target and sets it. (Sized_relobj::setup): Take a Target object instead of an elfcpp:Ehdr as parameter. * target.cc: Include dynobj.h. (Target::do_make_elf_object_implementation): New. (Target::do_make_elf_object): New. * target.h (Target::make_elf_object): New template declaration. (Target::do_make_elf_object): New method declarations. (Target::do_make_elf_object_implementation): New template declaration.
* *** empty log message ***Sriraman Tallam2009-08-051-29/+129
|
* PR 10400Ian Lance Taylor2009-07-171-83/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * layout.h: #include <map>. (class Kept_section): Change from struct to class. Add accessors and setters. Add section size to Comdat_group mapping. Change Comdat_group to std::map. Add is_comdat_ field. Add linkonce_size field in union. (class Layout): Update declaration of find_or_add_kept_section. Don't declare find_kept_object. * layout.cc (Layout::find_or_add_kept_section): Remove candidate parameter. Add object, shndx, is_comdat, and is_group_name parameters. Change all callers. Adjust for new Kept_section. (Layout::find_kept_object): Remove. * object.cc (Sized_relobj::include_section_group): Update use of Kept_section. Rename secnum to shndx. Only record Kept_comdat_section if sections are the same size. (Sized_relobj::include_linkonce_section): Update use of Kept_section. Only record Kept_comdat_section if sections are the same size. Set size of linkonce section. (Sized_relobj::map_to_kept_section): Update call to get_kept_comdat_section. * object.h (class Sized_relobj): Rename fields in Kept_comdat_section to drop trailing underscores; change object field to Relobj*. Change Kept_comdat_section_table to store struct rather than pointer. (Sized_relobj::set_kept_comdat_section): Remove kept parameter. Add kept_object and kept_shndx parameters. Change all callers. (Sized_relobj::get_kept_comdat_section): Change return type to bool. Add kept_object and kept_shndx parameters. Change all callers. * plugin.cc (Pluginobj::include_comdat_group): Update call to Layout::find_or_add_kept_section.
* PR 10147Ian Lance Taylor2009-06-231-0/+11
| | | | | | | * object.cc (Object::section_contents): Don't try to get a view if the section has length zero. (Object::handle_gnu_warning_section): If the section is empty, use the name of the section as the warning.
* * layout.cc (Layout::make_output_section): CallIan Lance Taylor2009-06-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Target::new_output_section. (Layout::attach_allocated_section_to_segment): Put large section sections in a separate load segment with the large segment flag set. (Layout::segment_precedes): Sort large data segments after other load segments. (align_file_offset): New static function. (Layout::set_segment_offsets): Use align_file_offset. * output.h (class Output_section): Add is_small_section_ and is_large_section_ fields. (Output_section::is_small_section): New function. (Output_section::set_is_small_section): New function. (Output_section::is_large_section): New function. (Output_section::set_is_large_section): New function. (Output_section::is_large_data_section): New function. (class Output_segment): Add is_large_data_segment_ field. (Output_segment::is_large_data_segment): New function. (Output_segment::set_is_large_data_segment): New function. * output.cc (Output_section::Output_section): Initialize new fields. (Output_segment::Output_segment): Likewise. (Output_segment::add_output_section): Add assertion that large data sections always go in large data segments. Force small data sections to the end of the list of data sections. Force small BSS sections to the start of the list of BSS sections. For large BSS sections to the end of the list of BSS sections. * symtab.h (class Symbol): Declare is_common_shndx. (Symbol::is_defined): Check Symbol::is_common_shndx. (Symbol::is_common): Likewise. (class Symbol_table): Define enum Commons_section_type. Update declarations. Add small_commons_ and large_commons_ fields. * symtab.cc (Symbol::is_common_shndx): New function. (Symbol_table::Symbol_table): Initialize new fields. (Symbol_table::add_from_object): Put small and large common symbols in the right list. (Symbol_table::sized_finalized_symbol): Check Symbol::is_common_shndx. (Symbol_table::sized_write_globals): Likewise. * common.cc (Symbol_table::do_allocate_commons): Allocate new common symbol lists. Don't call do_allocate_commons_list if the list is empty. (Symbol_table::do_allocate_commons_list): Remove is_tls parameter. Add comons_section_type parameter. Change all callers. Handle small and large common symbols. * object.cc (Sized_relobj::do_finalize_local_symbols): Check Symbol::is_common_shndx. * resolve.cc (symbol_to_bits): Likewise. * target.h (Target::small_common_shndx): New function. (Target::small_common_section_flags): New function. (Target::large_common_shndx): New function. (Target::large_common_section_flags): New function. (Target::new_output_section): New function. (Target::Target_info): Add small_common_shndx, large_common_shndx, small_common_section_flags, and large_common_section_flags fields. (Target::do_new_output_section): New virtual function. * arm.cc (Target_arm::arm_info): Initialize new fields. * i386.cc (Target_i386::i386_info): Likewise. * powerpc.cc (Target_powerpc::powerpc_info) [all versions]: Likewise. * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise. * x86_64.cc (Target_x86_64::x86_64_info): Likewise. (Target_x86_64::do_new_output_section): New function. * configure.ac: Define conditional MCMODEL_MEDIUM. * testsuite/Makefile.am (check_PROGRAMS): Add large. (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define. (large_LDFLAGS): Define. * testsuite/large.c: New file. * testsuite/testfile.cc (Target_test::test_target_info): Initialize new fields. * configure, testsuite/Makefile.in: Rebuild.
* 2009-06-05 Doug Kwan <dougkwan@google.com>Doug Kwan2009-06-051-1/+23
| | | | | | | | | | | | | | | | | | | | | | * Makefile.am (CCFILES): Add target.cc. * Makefile.in: Regenerate. * i386.cc (class Target_i386): Define new virtual method to override do_is_local_label_name in parent. * object.cc (Sized_relobj::do_count_local_symbols): Discard local symbols if --discard-locals or -X is given. * options.h (class General_options): Declare new options '--discard-locals' and '-X' for discarding locals. * target.h (class Target): Define new methods is_local_label_name. Declare new virtual method do_is_local_label_name. * target.cc: New file. * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test. (check_SCRIPTS): Add discard_locals_test.sh. (check_DATA): Add discard_local_tests.syms. (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define. (discard_local_tests.syms, discard_locals_test.o): New make rules. * testsuite/Makefile.in: Regenerate. * testsuite/discard_locals_test.c: New file. * testsuite/discard_locals_test.sh: Same.
* 2009-06-05 Doug Kwan <dougkwan@google.com>Doug Kwan2009-06-051-4/+20
| | | | | | | | | | | | | | | * object.cc (Sized_relobj::Sized_relobj): Initialize discarded_eh_frame_shndx_ to -1U. (Sized_relobj::do_layout): Record index of a discard .eh_frame section. (Sized_relobj::do_count_local_symbols): Skip local symbols in a discarded .eh_frame section. (Sized_relobj::do_finalize_local_symbols): Ditto. * object.h (class Sized_relobj): Declare new member discarded_eh_frame_shndx_. * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test. (local_labels_test.o, local_labels_test): New rules. * testsuite/Makefile.in: Regenerate.
* * object.cc (Sized_relobj::map_to_kept_section): Return NULL if theSriraman Tallam2009-05-221-2/+2
| | | | | | | | | kept comdat section was garbage collected. * testsuite/Makefile.am: Add test gc_comdat_test.sh. * testsuite/Makefile.in: Regenerate. * testsuite/gc_comdat_test.sh: New file. * testsuite/gc_comdat_test_1.cc: New file. * testsuite/gc_comdat_test_2.cc: New file.
* * object.cc (is_elf_object): Define.Ian Lance Taylor2009-03-241-0/+27
| | | | | | | * object.h (is_elf_object): Declare. * archive.cc (Archive::get_elf_object_for_member): Call is_elf_object. * readsymc.cc (Read_symbols::do_read_symbols): Likewise.
* * readsyms.cc (Read_symbols::incompatible_warning): New function.Ian Lance Taylor2009-03-141-13/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (Read_symbols::requeue): New function. (Read_symbols::do_read_symbols): If make_elf_object fails because the target type is not configured, and the file was searched for, issue a warning and retry with the next directory. (Add_symbols::run): If the file has an incompatible format, and it was searched for, requeue the Read_symbols task. On error, release the object. * readsyms.h (class Read_symbols): Add dirindex_ field. Add dirindex parameter to constructor. Change all callers. Declare incompatible_warning and requeue. (class Add_symbols): Add dirpath_, dirindex_, mapfile_, input_argument_ and input_group_ fields. Add them to constructor. Change all callers. (class Read_script): Add dirindex_ field. Add it to constructor. Change all callers. * archive.cc (Archive::setup): Remove input_objects parameter. Change all callers. (Archive::get_file_and_offset): Likewise. (Archive::read_all_symbols): Likewise. (Archive::read_symbols): Likewise. (Archive::get_elf_object_for_member): Remove input_objects parameter. Add punconfigured parameter. Change all callers. (Archive::add_symbols): Change return type to bool. Check return value of include_member. (Archive::include_all_members): Likewise. (Archive::include_member): Change return type to bool. Return false if first included object has incompatible target. Set included_member_ field. (Add_archive_symbols::run): If add_symbols returns false, requeue Read_symbols task. * archive.h (class Archive): Add included_member_ field. Initialize it in constructor. Add input_file and searched_for methods. Update declarations. (class Add_archive_symbols): Add dirpath_, dirindex_, and input_argument_ fields. Add them to constructor. Change all callers. * script.cc: Include "target-select.h". (class Parser_closure): Add skip_on_incompatible_target_ and found_incompatible_target_ fields. Add skip_on_incompatible_target parameter to constructor. Change all callers. Add methods skip_on_incompatible_target, clear_skip_on_incompatible_target, found_incompatible_target, and set_found_incompatible_target. (read_input_script): Add dirindex parameter. Change all callers. If parser finds an incompatible target, requeue Read_symbols task. (script_set_symbol): Clear skip_on_incompatible_target in closure. (script_add_assertion, script_parse_option): Likewise. (script_start_sections, script_add_phdr): Likewise. (script_check_output_format): New function. * script.h (read_input_script): Update declaration. * script-c.h (script_check_output_format): Declare. * yyscript.y (file_cmd): Handle OUTPUT_FORMAT. (ignore_cmd): Remove OUTPUT_FORMAT. * fileread.cc (Input_file::Input_file): Add explicit this. (Input_file::will_search_for): New function. (Input_file::open): Add pindex parameter. Change all callers. * fileread.h (class Input_file): Add input_file_argument method. Declare will_search_for. Update declarations. * object.cc (make_elf_object): Add punconfigured parameter. Change all callers. * object.h (class Object): Make input_file public. Add searched_for method. (make_elf_object): Update declaration. * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to restart search. * dirsearch.h (class Dirsearch): Update declaration. * options.h (class General_options): Add --warn-search-mismatch. * parameters.cc (Parameters::is_compatible_target): New function. * parameters.h (class Parameters): Declare is_compatible_target. * workqueue.cc (Workqueue::add_blocker): New function. * workqueue.h (class Workqueue): Declare add_blocker.
* * layout.cc (Layout::find_or_add_kept_section): New function.Ian Lance Taylor2009-03-011-34/+33
| | | | | | | | | | | | | | | | | | (Layout::add_comdat): Removed. * layout.h (struct Kept_section): Move out of class Layout. Remove trailing underscores from field names. Add group_sections field. Rename group_ field to is_group. Change all uses. (class Layout): Declare find_or_add_kept_section, not add_comdat. * object.cc (Sized_relobj::Sized_relobj): Don't initialize comdat_groups_ field. (Sized_relobj::include_section_group): Use find_or_add_kept_section and Kept_section::group_sections. (Sized_relobj::include_linkonce_section): Likewise. * object.cc (class Sized_relobj): Don't define Comdat_group or Comdat_group_table. Remove find_comdat_group and add_comdat_group. Remove comdat_groups_ field. * plugin.cc (include_comdat_group): Use Layout::find_or_add_kept_section.
* PR 6992Ian Lance Taylor2009-02-281-1/+2
| | | | | | | | * symtab.cc (Symbol_table::sized_write_section_symbol): In a relocatable link set the value of the section symbol to zero. * object.cc (Sized_relobj::do_finalize_local_symbols): In a relocatable link don't include the section address in the local symbol value.
* PR 6811Ian Lance Taylor2009-02-281-24/+0
| | | | | | | | | | | | | | | | | | | | | * options.h (class Search_directory): Add is_system_directory. (class General_options): Declare is_in_system_directory. * options.cc (get_relative_sysroot): Make static. (get_default_sysroot): Make static. (General_optoins::is_in_system_directory): New function. * fileread.cc (Input_file::is_in_system_directory): New function. * fileread.h (class Input_file): Declare is_in_system_directory. * object.h (class Object): Add is_in_system_directory. (class Input_objects): Remove system_library_directory_ field. * object.cc (Input_objects::add_object): Don't set system_library_directory_. (input_objects::found_in_system_library_directory): Remove. * symtab.cc (Symbol_table::write_globals): Remove input_objects parameter. Change all callers. (Symbol_table::sized_write_globals): Likewise. (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise. Call Object::is_in_system_directory. * symtab.h (class Symbol_table): Update declarations.
* PR 7091Ian Lance Taylor2009-02-281-10/+21
| | | | | | | | | | * output.cc (Output_section::find_starting_output_address): Rename from starting_output_address; add PADDR parameter; change return type. * output.h (class Output_section): Declare find_starting_output_address instead of starting_output_address. * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a section symbol for which we can't find a merge section.
* (From Rafael Espindola)Cary Coutant2009-02-131-1/+2
| | | | | | | | | | | | | | | | | | | | | * archive.cc (Archive::include_member): Update calls to add_symbols. * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add the Layout argument. * dynobj.h (do_add_symbols): Add the Layout argument. * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the Layout argument. * object.h (Object::add_symbols): Add the Layout argument. (Object::do_add_symbols): Add the Layout argument. (Sized_relobj::do_add_symbols): Add the Layout argument. * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols): Unify the two versions. (Add_plugin_symbols): Remove. * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove. (Sized_pluginobj::do_add_symbols): Unify the two versions. (Add_plugin_symbols): Remove. * readsyms.cc (Read_symbols::do_read_symbols): Update call to Add_symbols. Use Add_symbols instead of Add_plugin_symbols. (Add_symbols::run): Make it work with Pulginobj.
* * object.cc (Sized_relobj::do_layout): Make info message startIan Lance Taylor2009-02-071-1/+1
| | | | with lower case letter.