aboutsummaryrefslogtreecommitdiff
path: root/gold/arm.cc
AgeCommit message (Collapse)AuthorFilesLines
2010-02-132010-02-12 Sriraman Tallam <tmsriram@google.com>Sriraman Tallam1-0/+19
* arm.cc (Scan::local_reloc_may_be_function_pointer): New function. (Scan::global_reloc_may_be_function_pointer): New function. * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function. (Scan::global_reloc_may_be_function_pointer): New function. * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function. (Scan::global_reloc_may_be_function_pointer): New function. * i386.cc (Scan::local_reloc_may_be_function_pointer): New function. (Scan::global_reloc_may_be_function_pointer): New function. * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function. (Scan::global_reloc_may_be_function_pointer): New function. (Scan::possible_function_pointer_reloc): New function. (Target_x86_64::can_check_for_function_pointers): New function. * gc.h (gc_process_relocs): Scan relocation types to determine if function pointers were taken for targets that support it. * icf.cc (Icf::find_identical_sections): Include functions for folding in safe ICF whose pointer is not taken. * icf.h (Secn_fptr_taken_set): New typedef. (fptr_section_id_): New member. (section_has_function_pointers): New function. (set_section_has_function_pointers): New function. (check_section_for_function_pointers): New function. * options.h: Fix comment for safe ICF option. * target.h (can_check_for_function_pointers): New function. * testsuite/Makefile.am: Add icf_safe_so_test test case. Modify icf_safe_test for X86-64. * testsuite/Makefile.in: Regenerate. * testsuite/icf_safe_so_test.cc: New file. * testsuite/icf_safe_so_test.sh: New file. * testsuite/icf_safe_test.cc (kept_func_3): New function. (main): Change to take pointer to function kept_func_3. * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe folding is done correctly for X86-64.
2010-02-122010-02-11 Doug Kwan <dougkwan@google.com>Doug Kwan1-140/+182
* arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling. (Target_arm::Scan::global): Ditto. Also remove a comment before the beginning of function. (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS and MOVT_ABS relocations. Those are non issued in scanning. Fix parameter is_32bit in calls to should_apply_static_reloc. * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh. (check_DATA): Add arm_abs_global.stdout. (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global, arm_abs_global.stdout): New rules. (MOSTLLYCLEANFILES): Add arm_abs_global * Makefile.in: Regenerate. * testsuite/arm_abs_global.s: New file. * testsuite/arm_abs_global.sh: Ditto. * testsuite/arm_abs_lib.s: Ditto.
2010-02-09 * output.h (Output_data_dynamic::add_section_size): New methodDavid S. Miller1-1/+1
that takes two Output_data objects. (Output_data_dynamic::Dynamic_entry): Create storage for secondary entry param. Handle it in initializers. * output.cc (Output_data_dynamic::Dynamic_entry::write): For DYNAMIC_SECTION_SIZE, add in second object size if non-NULL. * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt arg. * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt, and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt * arm.cc (Target_arm::do_finalize_sections): Update to pass false for dynrel_includes_plt. * i386.cc (Target_i386::do_finalize_sections): Likewise. * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise. * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output before .rela.plt (Target_sparc::do_finalize_sections): Update to pass true for dynrel_includes_plt. * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be output before .rela.plt (Target_powerpc::do_finalize_sections): Update to pass true for dynrel_includes_plt when 32-bit.
2010-02-092010-02-08 Doug Kwan <dougkwan@google.com>Doug Kwan1-5/+33
* arm.cc (Arm_relobj::simple_input_section_output_address): New method. (Arm_relobj::section_needs_cortex_a8_stub_scanning, Arm_relobj::scan_section_for_cortex_a8_stubs, Arm_relobj::do_relocation_section): Instead of calling Output_section::output_address, use faster Arm_relobj::simple_input_section_output_address.
2010-02-062010-02-05 Doug Kwan <dougkwan@google.com>Doug Kwan1-28/+54
PR 11247 * arm.cc (Arm_relobj::section_is_scannable): New method. (Arm_relobj::section_needs_reloc_stub_scanning): Use it. (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
2010-02-042010-02-03 Doug Kwan <dougkwan@google.com>Doug Kwan1-523/+133
* arm-reloc-property.cc (Arm_reloc_property_table::reloc_name_in_error_message): New method definition. * arm-reloc-property.h (Arm_reloc_property_table::get_implemented_static_reloc_property): New method definition. (Arm_reloc_property_table::reloc_name_in_error_message): New method declaration. * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change overflow to N. (GOT_PREL): Change implemented to Y. * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method. (Target_arm::Relocate::reloc_needs_sym_origin): Remove method. (Arm_relocate_functions::movw_abs_nc): Remove method. (Arm_relocate_functions::movt_abs): Ditto. (Arm_relocate_functions::thm_movw_abs_nc): Ditto. (Arm_relocate_functions::thm_movt_abs): Ditto. (Arm_relocate_functions::movw_rel_nc): Ditto. (Arm_relocate_functions::movw_rel): Ditto. (Arm_relocate_functions::movt_rel): Ditto. (Arm_relocate_functions:thm_movw_rel_nc): Ditto. (Arm_relocate_functions:thm_movw_rel): Ditto. (Arm_relocate_functions:thm_movt_rel): Ditto. (Arm_relocate_functions::movw, Arm_relocate_functions::movt, (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt): New method definitions. (Arm_relocation_functions::arm_grp_alu): Add assertion for group index. (Arm_relocation_functions::arm_grp_ldr): Ditto. (Arm_relocation_functions::arm_grp_ldrs): Ditto. (Arm_relocation_functions::arm_grp_ldc): Ditto. (Target_arm::Relocate::relocate): Check for non-static or unimplemented relocation code and exit early. Change calls to Target_arm::reloc_uses_thumb_bit and Target_arm::Reloc::reloc_needs_sym_origin to use relocation property instead. Refactor code to handle similar relocations to increase code sharing. Remove check for unsupported relocation code in switch statement. (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use relocation property table to find out size. Change error message to print out the name of a relocation code instead of the numeric value. (Target_arm::scan_reloc_for_stub): Use relocation property table instead of calling Target_arm::reloc_uses_thumb_bit().
2010-02-032010-02-03 Doug Kwan <dougkwan@google.com>Doug Kwan1-17/+18
* arm.cc (Target_arm::relocate_section): Do view adjustment for all types of relaxed input section.
2010-02-032010-02-02 Doug Kwan <dougkwan@google.com>Doug Kwan1-20/+27
* Makefile.am (HFILES): Add arm-reloc-property.h. (DEFFILES): New. (TARGETSOURCES): Add arm-reloc-property.cc (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT) (libgold_a_SOURCES): $(DEFFILES) * Makefile.in: Regenerate. * arm-reloc-property.cc: New file. * arm-reloc-property.h: New file. * arm-reloc.def: New file. * arm.cc: Update comments. (arm-reloc-property.h): New included header. (arm_reloc_property_table): New global variable. (Target_arm::do_select_as_default_target): New method definition. * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add arm-reloc-property to targ_extra_obj. * parameters.cc (set_parameters_target): Call Target::select_as_default_target(). * target.h (Target::select_as_default_target): New method definition. (Target::do_select_as_default_target): Same.
2010-02-022010-02-01 Doug Kwan <dougkwan@google.com>Doug Kwan1-1/+26
* arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize first_output_text_section_. (Arm_exidx_fixup::first_output_text_section): New method definition. (Arm_exidx_fixup::first_output_text_section_): New data member. (Arm_exidx_fixup::process_exidx_section): Record the first text output section seen. (Arm_output_section::fix_exidx_coverage): Set correct linked section and entsize in output section header.
2010-01-302010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>Doug Kwan1-3/+134
* gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8, R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0. (Arm_relocate_functions::thm_alu11): New Method. (Arm_relocate_functions::thm_pc8): New Method. (Arm_relocate_functions::thm_pc12): New Method. (Target_arm::Scan::local): Handle the relocations. (Target_arm::Scan::global): Likewise. (Target_arm::Relocate::relocate): Likewise. (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2010-01-302010-01-29 Doug Kwan <dougkwan@google.com>Doug Kwan1-22/+2
* arm.cc (Target_arm::Scan::global): General PLTs for the same set of relocation types as ld.
2010-01-292010-01-29 Doug Kwan <dougkwan@google.com>Doug Kwan1-148/+12
* arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility to public. (Arm_relocate_functions::thumb_branch_common): Ditto. (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24, Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32, Arm_relocate_functions::xpc25, Arm_relocate_functions::call, Arm_relocate_functions::jump24): Remove. (Target_arm::Relocate::relocate): Adjust code to call Arm_relocation_functions::arm_branch_common and Arm_relocation_functions::thumb_branch_common instead of their removed wrappers. Merge switch-cases together to reduce source code size.
2010-01-292010-01-29 Doug Kwan <dougkwan@google.com>Doug Kwan1-6/+147
* arm.cc (Arm_relobj::Arm_relobj): Initialize new data member output_local_symbol_count_needs_update_. (Arm_relobj::output_local_symbol_count_needs_update, Arm_relobj::set_output_local_symbol_count_needs_update, Arm_relobj::update_output_local_symbol_count): New methods. (Arm_relobj::output_local_symbol_count_needs_update_): New data member. (Arm_exidx_cantunwind::do_fixed_endian_write): Write address of pointed function as in a R_ARM_PREL31 relocation. (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects for output local symbol count updating. (Target_arm::do_relax): Update output local symbol counts in objects if necessary. * object.h (Sized_relobj::set_output_local_symbol_count): New method.
2010-01-29 * arm.cc: Added support for the ARM relocations:Ian Lance Taylor1-34/+126
R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL, R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL. (Arm_relocate_functions::movw_rel_nc): Renamed (was movw_prel_nc). (Arm_relocate_functions::movw_rel): New method. (Arm_relocate_functions::movt_rel): Renamed (was movt_prel). (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was thm_movw_prel_nc). (Arm_relocate_functions::thm_movw_rel): New method. (Arm_relocate_functions::thm_movt_rel): Renamed (was thm_movt_prel). (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL relocations. (Target_arm::Scan::global): Likewise. (Target_arm::Relocate::relocate): Likewise. (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2010-01-27 * arm.cc: Added support for ARM group relocations.Ian Lance Taylor1-78/+581
(Target_arm::reloc_needs_sym_origin): New method. (Arm_relocate_functions::calc_grp_kn): New method. (Arm_relocate_functions::calc_grp_residual): New method. (Arm_relocate_functions::calc_grp_gn): New method. (Arm_relocate_functions::arm_grp_alu): New Method. (Arm_relocate_functions::arm_grp_ldr): New Method. (Arm_relocate_functions::arm_grp_ldrs): New Method. (Arm_relocate_functions::arm_grp_ldc): New Method. (Target_arm::Scan::local): Handle the ARM group relocations. (Target_arm::Scan::global): Likewise. (Target_arm::Relocate::relocate): Likewise. (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2010-01-262010-01-26 Doug Kwan <dougkwan@google.com>Doug Kwan1-10/+278
* arm.cc (set): Include. (class Arm_exidx_fixup): Change type of last_input_section_ to const pointer type. (Arm_output_section::Text_section_list): New type. (Arm_output_section::append_text_sections_to_list): New method. (Arm_output_section::fix_exidx_coverage): Ditto. (Arm_relobj::Arm_relobj): Initialize exidx_section_map_. (Arm_relobj::convert_input_section_to_relaxed_section): Use Relobj::set_section_offset() instead of Sized_relobj::invalidate_section_offset(). (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra parameter for section headers. Ignore relocation sections for unallocated sections and EXIDX sections. (Target_arm::fix_exidx_coverage): New method. (Target_arm::output_section_address_less_than): New type. (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the linked text section instead of the EXIDX section. (Arm_output_section::create_stub_group): Add an assertion to check that this is not an EXIDX output section. (Arm_output_section::append_text_sections_to_list): New method. (Arm_output_section::fix_exidx_coverage): Ditto. (Arm_relobj::scan_sections_for_stubs): Adjust call to Arm_relobj::section_needs_reloc_stub_scanning. (Target_arm::do_relax): Fix EXIDX output section coverage in the first pass. (Target_arm::fix_exidx_coverage): New method. * object.h (Relobj::set_output_section): New method. (Sized_relobj::invalidate_section_offset): Remove method. (Sized_relobj::do_invalidate_section_offset): Remove method. (Sized_relobj::do_set_section_offset): Handle offset value -1.
2010-01-252010-01-25 Doug Kwan <dougkwan@google.com>Doug Kwan1-1/+3
* arm.cc (Arm_exidx_merged_section::do_output_offset): Fix warning due to signed and unsigned comparison on a 32-bit host.
2010-01-232010-01-22 Doug Kwan <dougkwan@google.com>Doug Kwan1-1/+25
* arm.cc (Target_arm::do_relax): Record an output section for section offset adjustment it contains any stub table that has changed. * layout.cc (Layout::clean_up_after_relaxation): Adjust section offsets in an output section if necessary. * output.cc (Output_section::Output_section): Initialize section_offsets_need_adjustments_. (Output_section::add_input_section_for_script): Renamed to Output_section::add_simple_input_section. (Output_section::save_states): Add a comment. (Output_section::discard_states): New method defintion. (Output_section::adjust_section_offsets): Same. * output.h (Output_section::add_input_section_for_script): Renamed to Output_section::add_simple_input_section. (Output_section::discard_states): New method declaration. (Output_section::adjust_section_offsets): Same. (Output_section::section_offsets_need_adjustment, Output_section::set_section_offsets_need_adjustment): New method definitions. (Output_section::section_offsets_need_adjustment_): New data member. * script-sections.cc (Output_section_element_input::set_section_address): Adjust code for renaming of Output_section::add_input_section_for_script. (Orphan_output_section::set_section_address): Same.
2010-01-222010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>Doug Kwan1-11/+15
* gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of Fix_v4bx enum values . * gold/options.h (General_options): New option definitions. (General_options::fix_v4bx): New method. (General_options::Fix_v4bx): New enum. * gold/options.cc (General_options::parse_fix_v4bx): New method. (General_options::parse_fix_v4bx_interworking): New method.
2010-01-222010-01-22 Doug Kwan <dougkwan@google.com>Doug Kwan1-0/+221
* arm.cc (Arm_exidx_fixup): New class.
2010-01-222010-01-21 Doug Kwan <dougkwan@google.com>Doug Kwan1-0/+266
elfcpp/ChangeLog: * arm.h (EXIDX_CANTUNWIND): New enum. gold/ChangeLog: * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New classes. (Arm_exidx_section_offset_map): New type.
2010-01-222010-01-21 Doug Kwan <dougkwan@google.com>Doug Kwan1-29/+175
* arm.cc (Arm_exidx_input_section): New class. (Arm_relobj::exidx_input_section_by_link, Arm_relobj::exidx_input_section_by_shndx, Arm_relobj::make_exidx_input_section): New methods. (read_arm_attributes_section): Remove. (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record information about them. (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section to here.
2010-01-202010-01-20 Doug Kwan <dougkwan@google.com>Doug Kwan1-7/+6
* arm.cc (Target_arm::Arm_input_section_map): Change key type from Input_section_specifier to Section_id. (Target_arm::new_arm_input_section: Adjust code for change of key type. (Target_arm::find_arm_input_section): Ditto. * gc.h (object.h): Include for Section_id nand Section_id_hash. (Section_id): Remove. (Garbage_collection::Section_id_hash): Remove. * icf.h (object.h): Include for Section_id nand Section_id_hash. (Section_id): Remove. (Icf::Section_id_hash): Remove. * object.h (Section_id, Const_section_id, Section_id_hash, Const_section_id_hash): New type definitions. * output.cc (Output_section::add_relaxed_input_section): Change to use Const_section_id instead of Input_section_specifier as key type. (Output_section::add_merge_input_section): Ditto. (Output_section::build_relaxation_map): Change to use Section_id instead of Input_section_specifier as key type. (Output_section::convert_input_sections_in_list_to_relaxed_sections): Ditto. (Output_section::convert_input_sections_to_relaxed_sections): Change to use Const_section_id instead of Input_section_specifier as key type. (Output_section::find_merge_section): Ditto. (Output_section::find_relaxed_input_section): Ditto. * output.h (Input_section_specifier): Remove class. (Output_section::Output_section_data_by_input_section_map): Change key type to Const_section_id. (Output_section::Output_relaxed_input_section_by_input_section_map): Ditto. (Output_section::Relaxation_map): Change key type to Section_id.
2010-01-20 * gold/arm.cc: Added support for R_ARM_V4BX relocationIan Lance Taylor1-6/+270
(class Arm_v4bx_stub): New class. (DEF_STUBS): Updated definition to support v4_veneer_bx. (Stub_factory::make_arm_v4bx_stub): New method. (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template. (Stub_table::empty): Handle v4bx stubs. (Stub_table::add_arm_v4bx_stub): New method. (Stub_table::find_arm_v4bx_stub): New method. (Arm_relocate_functions::v4bx): New method. (Target_arm::fix_v4bx): New method. (Target_arm::Target_arm): Handle R_ARM_V4BX. (Stub_table::relocate_stubs): Likewise. (Stub_table::do_write): Likewise. (Stub_table::update_data_size_and_addralign): Likewise. (Stub_table::finalize_stubs): Likewise. (Target_arm::Scan::local): Likewise. (Target_arm::Scan::global): Likewise. (Target_arm::do_finalize_sections): Likewise. (Target_arm::Relocate::relocate): Likewise. (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Likewise. (Target_arm::scan_reloc_for_stub): Likewise. (Target_arm::scan_reloc_section_for_stubs): Likewise.
2010-01-15 * arm.cc (Arm_relocate_functions::thm_jump6): New function.Ian Lance Taylor1-0/+87
(Arm_relocate_functions::thm_jump8): New function. (Arm_relocate_functions::thm_jump11): New function. (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8, R_ARM_THM_JUMP11. (Target_arm::Scan::global): Likewise. (Target_arm::Relocate::relocate): Likewise. (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2010-01-152010-01-14 Doug Kwan <dougkwan@google.com>Doug Kwan1-32/+145
* arm.cc (map, utility): Include headers. (Target_arm::apply_cortex_a8_workaround): New method. (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround. (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19. (Target_arm::Scan::global): R_ARM_THM_JUMP19. (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to the --[no-]fix-cortex-a8 command line options. (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19. (Target_arm::relocate_stub): Use addend in instruction template. * options.h (DEFINE_bool): Set the user-set flag. (General_options): Add --[no-]-fix-cortex options. * output.cc (Output_section::convert_input_sections_to_relaxed_sections) : Update fast look-up map after conversion.
2010-01-142010-01-13 Doug Kwan <dougkwan@google.com>Doug Kwan1-6/+10
* arm.cc (Arm_relobj::section_needs_reloc_stub_scanning, Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an apparent compiler problem of not folding static constant integral data members of elfcpp::Elf_sizes<32>.
2010-01-132010-01-13 Doug Kwan <dougkwan@google.com>Doug Kwan1-73/+420
* arm.cc (Arm_relobj::section_needs_reloc_stub_scanning, Arm_relobj::section_needs_cortex_a8_stub_scanning, Arm_relobj::scan_section_for_cortex_a8_erratum, Arm_relobj::scan_span_for_cortex_a8_erratum): New methods. (Arm_relobj::scan_sections_for_stubs): Move code deciding what sections to scan for relocation stubs into a new method Arm_relobj::section_needs_reloc_stub_scanning. Handle both relocation and Cortex-A8 stub scanning. (Target_arm::do_relax): Force stubs to be after stubbed sections if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at the beginning of a new relaxation pass. Update a comment. (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
2010-01-132010-01-12 Doug Kwan <dougkwan@google.com>Doug Kwan1-23/+105
* arm.cc (Cortex_a8_reloc): New class. (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_ and cortex_a8_relocs_info_. (Target_arm::fix_cortex_a8): New method definition. (Target_arm::Cortex_a8_relocs_info): New type. (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_): New data member declarations. (Target_arm::scan_reloc_for_stub): Record information about relocations for THUMB branches that might be exempted from the Cortex-A8 workaround. (Target_arm::do_relax): Clear all Cortex-A8 relocation information at the beginning of a relaxation pass.
2010-01-132010-01-12 Doug Kwan <dougkwan@google.com>Doug Kwan1-1/+66
* arm.cc (Arm_relobj::mapping_symbols_info_): New data member. (Arm_relobj::Mapping_symbol_position, Arm_reloj::Mapping_symbol_position_less, Arm_relobj::Mapping_symbols_info): New types. (Target_arm::is_mapping_symbol_name): New method definition. (Arm_relobj::do_count_local_symbols): Save information about mapping symbols.
2010-01-122010-01-11 Doug Kwan <dougkwan@google.com>Doug Kwan1-50/+143
* arm.cc (Arm_relocate_functions::thumb32_branch_offset, Arm_relocate_functions::thumb32_branch_upper, Arm_relocate_functions::thumb32_branch_lower, Arm_relocate_functions::thumb32_cond_branch_offset, Arm_relocate_functions::thumb32_cond_branch_upper, Arm_relocate_functions::thumb32_cond_branch_lower, Arm_relocate_functions::thm_jump19): New methods to handle THUMB branch offset encoding. (Arm_relocate_functions::thumb_branch_common): Use new branch offset encoding methods to avoid code duplication. (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE. (Stub_addend_reader::operator()): Use new branch encoding method to avoid code duplication.
2010-01-122010-01-11 Doug Kwan <dougkwan@google.com>Doug Kwan1-2/+44
* arm.cc (Arm_relobj::do_gc_process_relocs): New method. (Target_arm::do_finalize_sections): Define special EXIDX section symbols only if referenced. * gc.h (Garbage_collection::add_reference): New method. (gc_process_relocs): Use Garbage_collection::add_reference to avoid code duplication.
2010-01-092010-01-08 Doug Kwan <dougkwan@google.com>Doug Kwan1-84/+280
* arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_, prev_data_size_ and prev_addralign_. Remove initializer for deleted data member has_been_changed_. (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_ to determine if the table is empty. (Stub_table::has_been_changed, Stub_table_set_has_been_changed): Remove. (Stub_table::add_reloc_stub): Define method in class definition instead of just declaring it there. (Stub_table::add_cortex_a8_stub): New method definition. (Stub_table::update_data_size_and_addralign): Ditto. (Stub_table::finalize_stubs): Ditto. (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto. (Stub_table::do_addralign_): Return address alignment in the (Stub_table::do_reset_address_and_file_offset): Define method in class definition instead of declaring it there. Set current data size to be the data size of the previous pass. (Stub_table::set_final_data_size): Use current data size as the final data size. (Stub_table::relocate_stub): Change parameter type of stub from Reloc_stub pointer to Stub pointer. (Stub_table::addralign_, Stub_table::has_been_changed_): Remove. (Stub_table::Cortex_a8_stub_list): New typedef. (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_, Stub_table::prev_addralign_): New data member. (Arm_relobj::Arm_relobj): Initialize data member section_has_cortex_a8_workaround_. (Arm_relobj::section_has_cortex_a8_workaround, Arm_relobj::mark_section_for_cortex_a8_workaround): New method definitions. (Arm_relobj::section_has_cortex_a8_workaround_): New data member declarations. (Target_arm::relocate_stub): Change parameter type of stub from Reloc_stub pointer to Stub pointer. (Insn_template::size, Insn_template::alignment): Handle THUMB16_SPECIAL_TYPE. (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs, Stub_table::update_data_size_and_addralign, Stub_table::apply_cortex_a8_workaround_to_address_range): New method definitions. (Stub_table::relocate_stubs): Handle Cortex-A8 stubs. (Stub_table::do_write): Ditto. (Target_arm::do_relax): Adjust code for changes in Stub_table.
2010-01-07 * output.h (class Output_data): Add const version ofIan Lance Taylor1-33/+5
output_section and do_output_section. (class Output_section_data): Add const version of do_output_section. (class Output_section): Likewise. * layout.cc (Layout::add_target_dynamic_tags): New function. * layout.h (class Layout): Update declarations. * arm.cc (Target_arm::do_finalize_sections): Use add_target_dynamic_tags. * i386.cc (Target_i386::do_finalize_sections): Likewise. * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise. * sparc.cc (Target_sparc::do_finalize_sections): Likewise. * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2010-01-072010-01-07 Doug Kwan <dougkwan@google.com>Doug Kwan1-66/+214
* arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE. (Insn_template::thumb16_bcond_insn): New method declaration. (Insn_template): Fix spelling. (Stub::thumb16_special): New method declaration. (Stub::do_write): Define virtual method which was previously pure virtual. (Stub::do_thumb16_special): New method declaration. (Stub::do_fixed_endian_write): New template member. (Reloc_stub::do_write): Remove. (Reloc_stub::do_fixed_endian_write): Remove. (Cortex_a8_stub): New class definition. (Stub_factory::make_cortex_a8_stub): New method definition. (Stub_factory::Stub_factory): Add missing static storage class qualifier for elf32_arm_stub_a8_veneer_blx.
2009-12-30 * layout.cc (Layout::Layout): Initialize increase_relro_.Ian Lance Taylor1-8/+11
(Layout::get_output_section): Add is_relro, is_last_relro, and is_first_non_relro parameters. Change all callers. (Layout::choose_output_section): Likewise. (Layout::add_output_section_data): Likewise. (Layout::make_output_section): Likewise. (Layout::set_segment_offsets): Clear increase_relro when using a linker script. * layout.h (class Layout): Add increase_relro method. Add increase_relro_ field. Update declarations. * output.cc (Output_section::Output_section): Initialize is_last_relro_ and is_first_non_relro_. (Output_segment::add_output_section): Group relro sections is do_sort is true. Handle is_last_relro and is_first_non_relro. (Output_segment::maximum_alignment): Remove relro handling. (Output_segment::set_section_addresses): Add increase_relro parameter. Change all callers. Add initial alignment to align relro sections on separate page. Remove old relro handling. (Output_segment::set_section_list_addresses): Remove in_relro parameter. Change all callers. (Output_segment::set_offset): Add increase parameter. Change all callers. Remove old relro handling. * output.h (class Output_section): Add new methods: is_last_relro, set_is_last_relro, is_first_non_relro, set_is_first_non_relro. Add is_last_relro_ and is_first_non_relro_ fields. * i386.cc (Target_i386::got_section): Don't call set_is_relro. Create separate .got.plt section. Call increase_relro. * x86_64.cc (Target_x86_64::got_section): Likewise. * testsuite/relro_script_test.t: Add .got.plt.
2009-12-29 * symtab.h (class Symbol_table): Add enum Defined.Ian Lance Taylor1-4/+7
* 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-2/+4
* 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-257/+258
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-122009-12-11 Doug Kwan <dougkwan@google.com>Doug Kwan1-4/+3
* arm.cc (Target_arm::do_finalize_sections): Fix build breakage due to -Wshadow. * attributes.cc (Object_attribute::size): Ditto. (Attributes_section_data::size): Ditto. (Attributes_section_data::Attributes_section_data): Ditto. (Output_attributes_section_data::do_write): Ditto. * attributes.h (Object_attribute::set_type): Ditto. * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
2009-12-11Add -Wshadow to the gcc command line options used when compiling the binutils.Nick Clifton1-254/+254
Fix up all warnings generated by the addition of this switch.
2009-12-102009-12-10 Doug Kwan <dougkwan@google.com>Doug Kwan1-18/+964
elfcpp/ChangeLog * arm.h: New enums for EABI object attribute tags and values. gold/ChangeLog * arm.cc (attributes.h): New include. (Arm_relobj::Arm_relobj): Initialize attributes_section_data_. (Arm_relobj::~Arm_relobj): Delete object pointed by attributes_section_data_. (Arm_relobj::attributes_section_data): New method definition. (Arm_relobj::attributes_section_data_): New data member declaration. (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_. (Arm_dynobj::~Arm_dynobj): Delete object pointed by attributes_section_data_. (Arm_dynobj::attributes_section_data): New method definition. (Arm_dynobj::attributes_section_data_): New data member declaration. (Target_arm::Target_arm): Initialize attributes_section_data_. Change initialization value of may_use_blx_ to false. (Target_arm::using_thumb2, Target_arm::using_thumb_only, Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use object attributes to compute results instead of hard-coding. (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order, Target_arm::get_secondary_compatible_arch, Target_arm::set_secondary_compatible_arch Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name, Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes): New method declarations. (Target_arm::get_aeabi_object_attribute): New method definition. (Target_arm::attributes_section_data_): New data member declaration. (read_arm_attributes_section): New template definition. (Arm_relobj::do_read_symbols): Read attributes section if it exists. (Arm_dynobj::do_read_symbols): Ditto. (Target_arm::do_finalize_sections): Merge attributes sections from input. Check for BLX use after attributes section merging. Fix __exidx_start and __exidx_end visibility. Create an .ARM.attributes section if necessary. (Target_arm::get_secondary_compatible_arch, Target_arm::set_secondary_compatible_arch, Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name, Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes, Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order): New method definitions.
2009-12-062009-12-05 Doug Kwan <dougkwan@google.com>Doug Kwan1-1/+3
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-12-062009-12-05 Doug Kwan <dougkwan@google.com>Doug Kwan1-45/+47
* arm.cc: Update comments about interworking and stub generation. (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations considered as non-PIC. (Arm_relocate_functions::base_abs): Fix formatting. (Arm_relocate_functions::got_prel): Fix comment. Change interface of function to use GOT entry address instead of offset. (Target_arm::Scan::global): Issue an error if a symbol would need a PLT does not get one because it is untyped. Remove code to create dynamic symbols for relative branches. (Target_arm::Relocate::relocate: Use 0 instead of false since function takes unsigned integer instead of boolean.
2009-12-032009-12-03 Doug Kwan <dougkwan@google.com>Doug Kwan1-10/+19
* arm.cc: Remove comment about missing .ARM.exidx section symbols. (Target_arm::do_finalize_sections): Add parameter for symbol table pointer. Add __exidx_start and __exidx_end symbols as appropriate. * i386.cc (Target_i386::do_finalize_sections): Add an additional parameter for symbol table pointer. * layout.cc (Layout::finalize): Call Target::finalize_sections with an additional parameter for a pointer to symbol table. * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional parameter for a symbol table pointer. * sparc.cc (Target_sparc::do_finalize_sections): Ditto. * target.h (Target::finalize_sections, Target::do_finalize_sections): Ditto. * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional parameter for a symbol table pointer.
2009-11-252009-11-25 Doug Kwan <dougkwan@google.com>Doug Kwan1-62/+19
Revert: 2009-11-25 Doug Kwan <dougkwan@google.com> * arm.cc (Target_arm::Target_arm): Move method definition outside of class definition. Add code to handle --target1-rel, --target1-abs and --target2= options. (Target_arm::get_reloc_reloc_type): Change method to be non-static and const. (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data member declaration. (Target_arm::Scan::local, Target_arm::Scan::global, Target_arm::Relocate::relocate, Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust call to Target_arm::get_real_reloc_type. (Target_arm::get_real_reloc_type): Use command line options to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2. * options.h (--target1-rel, --target1-abs, --target2): New ARM-only options.
2009-11-252009-11-25 Doug Kwan <dougkwan@google.com>Doug Kwan1-19/+62
* arm.cc (Target_arm::Target_arm): Move method definition outside of class definition. Add code to handle --target1-rel, --target1-abs and --target2= options. (Target_arm::get_reloc_reloc_type): Change method to be non-static and const. (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data member declaration. (Target_arm::Scan::local, Target_arm::Scan::global, Target_arm::Relocate::relocate, Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust call to Target_arm::get_real_reloc_type. (Target_arm::get_real_reloc_type): Use command line options to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2. * options.h (--target1-rel, --target1-abs, --target2): New ARM-only options.
2009-11-252009-11-25 Doug Kwan <dougkwan@google.com>Doug Kwan1-38/+251
* arm.cc (Target_arm::Target_arm): Move method definition outside of class definition. Add code to handle --target1-rel, --target1-abs and --target2= options. (Target_arm::get_reloc_reloc_type): Change method to be non-static and const. (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data member declaration. (Target_arm::Scan::local, Target_arm::Scan::global, Target_arm::Relocate::relocate, Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust call to Target_arm::get_real_reloc_type. (Target_arm::get_real_reloc_type): Use command line options to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2. * options.h (--target1-rel, --target1-abs, --target2): New ARM-only options.
2009-11-162009-11-15 Doug Kwan <dougkwan@google.com>Doug Kwan1-82/+215
* arm.cc (Target_arm::may_use_arm_nop): New method definition. (Arm_relocate_functions::arm_branch_common): Change method defintion in class definition to a method declaration and update list of formal parameters. (Arm_relocate_functions::plt32, Arm_relocate_functions::call, Arm_relocation_functions::jump24): Adjust call to Arm_relocate_functions::arm_branch_common. Update list of formal parameters. (Arm_relocate_functions::xpc25): New method definition. (Arm_relocate_functions::arm_branch_common): Move method defintion out from class definition. Use stubs for mode-switching and extending branch ranges. (Target_arm::Relocate::relocate): Handle weakly-undefined symbols specially. Change code to enable use of stubs in ARM branches.
2009-11-092009-11-10 Doug Kwan <dougkwan@google.com>Doug Kwan1-18/+89
* arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter in method declaration. (Target_arm::relocate_stub): New method declaration. (Target_arm::default_target): Change to return a pointer instead of a const reference. (Reloc_stub::stub_type_for_reloc): Adjust for the change in Target_arm::default_target. (Arm_Relobj::do_relocate_sections): Remove options paramater in method definition. (Target_arm::relocate_section): Adjust view. (Target_arm::relocate_stub): New method definition.