Commit Graph

67 Commits

Author SHA1 Message Date
Ian Lance Taylor b10d287364 * arm.cc: Added support for ARM group relocations.
(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-27 15:17:46 +00:00
Doug Kwan 2b328d4ec5 2010-01-26 Doug Kwan <dougkwan@google.com>
* 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-26 21:29:10 +00:00
Doug Kwan c7f3c37113 2010-01-25 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_exidx_merged_section::do_output_offset):
	Fix warning due to signed and unsigned comparison on a 32-bit host.
2010-01-25 17:30:29 +00:00
Doug Kwan 8923b24c4b 2010-01-22 Doug Kwan <dougkwan@google.com>
* 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-23 01:07:59 +00:00
Doug Kwan 9b2fd36756 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
* 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-22 19:43:00 +00:00
Doug Kwan 80d0d023f5 2010-01-22 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_exidx_fixup): New class.
2010-01-22 17:53:18 +00:00
Doug Kwan af2cdeae83 2010-01-21 Doug Kwan <dougkwan@google.com>
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-22 06:06:46 +00:00
Doug Kwan 993d07c1d5 2010-01-21 Doug Kwan <dougkwan@google.com>
* 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-22 00:51:17 +00:00
Doug Kwan 5ac169d4b6 2010-01-20 Doug Kwan <dougkwan@google.com>
* 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 17:29:52 +00:00
Ian Lance Taylor a21620630e * gold/arm.cc: Added support for R_ARM_V4BX relocation
(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-20 16:49:09 +00:00
Ian Lance Taylor 800d0f5656 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
(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-15 15:41:42 +00:00
Doug Kwan 41263c058c 2010-01-14 Doug Kwan <dougkwan@google.com>
* 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-15 04:58:34 +00:00
Doug Kwan b521dfe453 2010-01-13 Doug Kwan <dougkwan@google.com>
* 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-14 02:42:20 +00:00
Doug Kwan 4427219284 2010-01-13 Doug Kwan <dougkwan@google.com>
* 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-13 21:36:47 +00:00
Doug Kwan a120bc7fab 2010-01-12 Doug Kwan <dougkwan@google.com>
* 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-13 06:44:01 +00:00
Doug Kwan 20138696be 2010-01-12 Doug Kwan <dougkwan@google.com>
* 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-13 02:00:39 +00:00
Doug Kwan 089d69dccd 2010-01-11 Doug Kwan <dougkwan@google.com>
* 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-12 07:54:37 +00:00
Doug Kwan 99e5bff2f9 2010-01-11 Doug Kwan <dougkwan@google.com>
* 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-12 07:22:56 +00:00
Doug Kwan 2fb7225c84 2010-01-08 Doug Kwan <dougkwan@google.com>
* 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-09 01:55:14 +00:00
Ian Lance Taylor ea715a34a7 * output.h (class Output_data): Add const version of
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-07 20:43:35 +00:00
Doug Kwan bb0d3eb035 2010-01-07 Doug Kwan <dougkwan@google.com>
* 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.
2010-01-07 18:38:43 +00:00
Ian Lance Taylor 1a2dff539b * layout.cc (Layout::Layout): Initialize increase_relro_.
(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-30 06:57:17 +00:00
Ian Lance Taylor 99fff23b2e * symtab.h (class Symbol_table): Add enum Defined.
* 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-29 00:31:48 +00:00
Doug Kwan d6344fb5ba 2009-12-16 Doug Kwan <dougkwan@google.com>
* 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-17 00:00:26 +00:00
Ian Lance Taylor 2ea9794110 Revert -Wshadow changes, all changes from:
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-14 19:53:05 +00:00
Doug Kwan b0eec2ccda 2009-12-11 Doug Kwan <dougkwan@google.com>
* 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-12 01:26:12 +00:00
Nick Clifton 91d6fa6a03 Add -Wshadow to the gcc command line options used when compiling the binutils.
Fix up all warnings generated by the addition of this switch.
2009-12-11 13:42:17 +00:00
Doug Kwan a0351a698b 2009-12-10 Doug Kwan <dougkwan@google.com>
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-10 20:55:33 +00:00
Doug Kwan 05a352e6a7 2009-12-05 Doug Kwan <dougkwan@google.com>
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-06 02:49:46 +00:00
Doug Kwan f4e5969cc0 2009-12-05 Doug Kwan <dougkwan@google.com>
* 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-06 02:20:53 +00:00
Doug Kwan f59f41f3e6 2009-12-03 Doug Kwan <dougkwan@google.com>
* 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-12-03 23:13:55 +00:00
Doug Kwan a6d1ef576a 2009-11-25 Doug Kwan <dougkwan@google.com>
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-25 08:08:45 +00:00
Doug Kwan 50aeb7d431 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-25 04:32:36 +00:00
Doug Kwan 5193828376 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-25 04:11:56 +00:00
Doug Kwan d204b6e935 2009-11-15 Doug Kwan <dougkwan@google.com>
* 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-16 03:39:11 +00:00
Doug Kwan 43d12afeb9 2009-11-10 Doug Kwan <dougkwan@google.com>
* 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.
2009-11-09 23:16:55 +00:00
Doug Kwan 2daedcd627 2009-11-09 Doug Kwan <dougkwan@google.com>
* arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
	(arm_symbol_value): Remove.
	(Arm_relocate_functions::arm_branch_common,
	Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
	Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
	Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
	Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
	Arm_relocate_functions::call, Arm_relocate_functions::jump24,
	Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
	Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
	Arm_relocate_functions::thm_mobw_abs_nc,
	Arm_relocate_functions::thm_mov_abs,
	Arm_relocate_functions::movw_prel_nc,
	Arm_relocate_functions::thm_movt_abs,
	Arm_relocate_functions::movt_prel,
	Arm_relocate_functions::thm_movw_prel_nc,
	Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
	(Target_arm::Relocate::relocate): Only decompose address into two
	parts if relocation type uses the thumb-bit and pass the actual
	bit instead of a flag indicating that the thumb-bit is used.  Adjust
	calls to methods in Arm_relocate_functions for this change.
2009-11-09 16:03:45 +00:00
Doug Kwan eb44217c8b 2009-11-06 Doug Kwan <dougkwan@google.com>
* arm.cc (class Reloc_stub): Correct a comment.
	(Target_arm::Target_arm): Initialize arm_input_section_map_.
	(Target_arm::scan_section_for_stubs): New method declaration.
	(Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
	Change methods from private to protected.
	(Target_arm::do_may_relax): New method definition.
	(Target_arm::do_relax, Target_arm::group_sections,
	Target_arm::scan_reloc_for_stub,
	Target_arm::scan_reloc_section_for_stubs): New method declarations.
	(Target_arm::arm_input_section_map_): New data member declaration.
	(Target_arm::scan_reloc_for_stub,
	Target_arm::scan_reloc_section_for_stubs,
	Target_arm::scan_section_for_stubs, Target_arm::group_sections,
	Target_arm::do_relax): New method definitions.
2009-11-07 01:58:06 +00:00
Ian Lance Taylor 22b127cceb PR 10887
* arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
	tags if data is discarded by linker script.
	* 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.
2009-11-04 16:35:51 +00:00
Ian Lance Taylor f5c870d25d * layout.cc (Layout::get_output_section): Add is_interp and
is_dynamic_linker_section parameters.  Change all callers.
	(Layout::choose_output_section): Likewise.
	(Layout::make_output_section): Likewise.
	(Layout::add_output_section_data): Add is_dynamic_linker_section
	parameter.  Change all callers.
	* layout.h (class Layout): Update declarations.
	* output.h (class Output_section): Add is_interp, set_is_interp,
	is_dynamic_linker_section, set_is_dynamic_linker_section methods.
	Add is_interp_, is_dynamic_linker_section_ fields.  Change
	generate_code_fills_at_write_ to a bitfield.
	* output.cc (Output_section::Output_sections): Initialize new
	fields.
	(Output_segment::add_output_section): Add do_sort parameter.
	Change all callers.
2009-11-04 15:56:03 +00:00
Doug Kwan 55da957988 2009-11-03 Doug Kwan <dougkwan@google.com>
* arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
	stub_factory_.
	(Target_arm::stub_factory): New method definition.
	(Target_arm::new_arm_input_section,
	Target_arm::find_arm_input_section, Target_arm::new_stub_table,
	Target_arm::reloc_uses_thumb_bit): New method declarations.
	(Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
	New type definitions.
	(Target_arm::stub_tables_, Target_arm::stub_factory_): New data
	member declarations.
	(Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
	Target_arm::find_arm_input_section, Target_arm::new_stub_table):
	New method definitions.
2009-11-03 21:18:13 +00:00
Doug Kwan ebd95253ac 2009-10-30 Doug Kwan <dougkwan@google.com>
* arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
2009-10-31 03:06:59 +00:00
Doug Kwan e9bbb53879 2009-10-30 Doug Kwan <dougkwan@google.com>
* arm.cc (Stub_addend_reader): New struct template definition
	and partial specializations.
	(Stub_addend_reader::operator()): New method definition for a
	partially specialized template.
2009-10-31 02:59:36 +00:00
Doug Kwan d5b40221bc 2009-10-30 Doug Kwan <dougkwan@google.com>
elfcpp/ChangeLog:
	* arm.h (EF_ARM_BE8, EF_ARM_EABIMASK, EF_ARM_EABI_UNKNOWN,
	EF_ARM_EABI_VER1, EF_ARM_EABI_VER2, EF_ARM_EABI_VER3,
	EF_ARM_EABI_VER4, EF_ARM_EABI_VER5): New enums for processor-specific
	flags.
	(arm_eabi_version): New inline function.
	* elfcpp.h: Add a comment about DT_ENCODING.

gold/ChangeLog:
	* arm.cc (Arm_relobj::processor_specific_flags): New method
	definition.
	(Arm_relobj::do_read_symbols): New method declaration.
	(Arm_relobj::processor_specific_flags_): New data member declaration.
	(Arm_dynobj): New class definition.
	(Target_arm::do_finalize_sections): Add input_objects parameter.
	(Target_arm::do_adjust_elf_header): New method declaration.
	(Target_arm::are_eabi_versions_compatible,
	(Target_arm::merge_processor_specific_flags): New method declaration.
	(Target_arm::do_make_elf_object): New overloaded method definitions
	and declaration.
	(Arm_relobj::do_read_symbols): New method definition.
	(Arm_dynobj::do_read_symbols): Ditto.
	(Target_arm::do_finalize_sections): Add input_objects parameters.
	Merge processor-specific flags from all input objects.
	(Target_arm::are_eabi_versions_compatible,
	Target_arm::merge_processor_specific_flags,
	Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
	New method definitions.
	* i386.cc (Target_i386::do_finalize_sections): Add unnamed
	Input_objects pointer type parameter.
	* layout.cc (Layout::finalize): Pass input objects to target's.
	finalize_sections function.
	* output.cc (Output_file_header::do_sized_write): Set ELF file
	header's processor-specific flags.
	* powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
	Input_objects pointer type parameter.
	* sparc.cc (Target_sparc::do_finalize_sections): Same.
	* target.h (Input_objects): New forward class declaration.
	(Target::processor_specific_flags,
	Target::are_processor_specific_flags_sect): New method definitions.
	(Target::finalize_sections): Add input_objects parameter.
	(Target::Target): Initialize processor_specific_flags_ and
	are_processor_specific_flags_set_.
	(Target::do_finalize_sections): Add unnamed Input_objects pointer type
	parameter.
	(Target::set_processor_specific_flags): New method definition.
	(Target::processor_specific_flags_,
	Target::are_processor_specific_flags_set_): New data member
	declarations.
	* x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
	Input_objects pointer type parameter.
2009-10-30 18:49:59 +00:00
Doug Kwan ebabffbd89 2009-10-30 Doug Kwan <dougkwan@google.com>
* arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
2009-10-30 18:00:55 +00:00
Ian Lance Taylor ad0f2072a6 * object.h (class Relobj): Drop options parameter from
gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
	do_scan_relocs, do_relocate.  Change all callers.
	(class Sized_relobj): Drop options parameters from
	do_gc_process_relocs, do_scan_relocs, do_relocate,
	do_relocate_sections, relocate_sections, emit_relocs_scan,
	emit_relocs_scan_reltype.  Change all callers.
	(struct Relocate_info): Remove options field and all references to
	it.
	* reloc.h (class Read_relocs): Remove options constructor
	parameter and options_ field.  Change all callers.
	(class Gc_process_relocs, class Scan_relocs): Likewise.
	(class Relocate_task): Likewise.
	* target-reloc.h (scan_relocs): Remove options parameter.  Change
	all callers.
	(scan_relocatable_relocs): Likewise.
	* target.h (class Sized_target): Remove options parameter from
	gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
	all callers.
	* gc.h (gc_process_relocs): Remove options parameter.  Change all
	callers.
	* arm.cc: Update functions to remove options parameters.
	* i386.cc: Likewise.
	* powerpc.cc: Likewise.
	* sparc.cc: Likewise.
	* x86_64.cc: Likewise.
	* testsuite/testfile.cc: Likewise.
2009-10-29 05:16:23 +00:00
Doug Kwan 8ffa366761 2009-10-28 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_relobj): New class definition.
	(Arm_relobj::scan_sections_for_stubs,
	Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
	New method definitions.
2009-10-29 01:53:35 +00:00
Doug Kwan 07f508a253 2009-10-24 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
	(Arm_input_section::as_arm_input_section): New method.
	(Arm_output_section): New class definition.
	(Arm_output_section::create_stub_group,
	Arm_output_section::group_sections): New method definitions.
2009-10-24 09:36:15 +00:00
Doug Kwan 10ad9fe591 2009-10-22 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_input_section): New class definition.
	(Arm_input_section::init, Arm_input_section:do_write,
	Arm_input_section::set_final_data_size,
	Arm_input_section::do_reset_address_and_file_offset): New method
	definitions.
2009-10-22 18:58:02 +00:00
Doug Kwan 56ee5e00a8 2009-10-21 Doug Kwan <dougkwan@google.com>
* arm.cc (Stub_table, Arm_input_section): New forward class
	declarations.
	(Stub_table): New class defintion.
	(Stub_table::add_reloc_stub, Stub_table::relocate_stubs
	Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
	New method definition.
2009-10-21 18:33:18 +00:00