Commit Graph

193 Commits

Author SHA1 Message Date
Doug Kwan f4a8b6d7ab 2011-11-11 Doug Kwan <dougkwan@google.com>
* arm.cc (Target_arm::do_make_elf_object): Allow executable also
	if --just-symbols is given.
2011-11-11 21:49:36 +00:00
Doug Kwan 29ab395d2b 2011-11-10 Doug Kwan <dougkwan@google.com>
PR gold/13362
	* arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
	when processing data relocs.
	* reloc.h (Relocate_functions::rel_unaligned): New method.
	(Relocate_functions::pcrel_unaligned): Ditto.
	(Relocate_functions::rel32_unaligned): Ditto.
	(Relocate_functions::pcrel32_unaligned): Ditto.
2011-11-10 20:53:36 +00:00
Doug Kwan 2c339f710d 2011-11-09 Doug Kwan <dougkwan@google.com>
PR gold/13362
	* arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
	Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
	* reloc.h (Relocatable_relocs::Reloc_strategy): New enum
	RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
	(Relocate_functions::rel_unaligned): New.
	(Relocate_functions::rel32_unaligned): New.
	* target-reloc.h (relocate_for_relocatable): Add code to handle
	RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
	* testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
	arm_unaligned_reloc_r): New targets.
	* testsuite/Makefile.in: Regenerate.
	* arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
	linking.
2011-11-10 00:41:53 +00:00
Ian Lance Taylor a8e2273bba * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
we are working around the ARM1176 Erratum.
	* options.h (General_options::fix_arm1176): Add option.
	* testsuite/Makefile.am: Add testcases, and keep current ones
	working.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/arm_fix_1176.s: New file.
	* testsuite/arm_fix_1176.sh: Likewise.
2011-11-03 03:38:34 +00:00
Ian Lance Taylor cd6eab1c16 * arm.cc (Target_arm::Target_arm): Remove initialisation of
may_use_blx_.
	(Target_arm::may_use_blx): Remove method.
	(Target_arm::set_may_use_blx): Likewise.
	(Target_arm::may_use_v4t_interworking): New method.
	(Target_arm::may_use_v5t_interworking): Likewise.
	(Target_arm::may_use_blx_): Remove member variable.
	(Arm_relocate_functions::arm_branch_common): Check for v5T
	interworking.
	(Arm_relocate_functions::thumb_branch_common): Likewise.
	(Reloc_stub::stub_type_for_reloc): Likewise.
	(Target_arm::do_finalize_sections): Correct interworking checks.
	* testsuite/Makefile.am: Add new tests.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/arm_farcall_arm_arm.s: New test.
	* testsuite/arm_farcall_arm_arm.sh: Likewise.
	* testsuite/arm_farcall_arm_thumb.s: Likewise.
	* testsuite/arm_farcall_arm_thumb.sh: Likewise.
	* testsuite/arm_farcall_thumb_arm.s: Likewise.
	* testsuite/arm_farcall_thumb_arm.sh: Likewise.
	* testsuite/arm_farcall_thumb_thumb.s: Likewise.
	* testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2011-11-02 19:11:48 +00:00
Doug Kwan f6cccc2cd8 2011-07-05 Doug Kwan <dougkwan@google.com>
PR gold/12771
	* arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
	Arm_Address type for relocation result.
	(Arm_relocate_functions::abs16): Use unaligned access.  Also fix
	overflow check.
	(Arm_relocate_functions::abs32): Use unaligned access.
	(Arm_relocate_functions::rel32): Ditto.
	(Arm_relocate_functions::prel31): Ditto.
	(Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
	* testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
	static data relocations.
	* testsuite/Makefile.in: Regnerate.
	* testsuite/arm_unaligned_reloc.{s,sh}: New files.
2011-07-06 17:58:42 +00:00
Ian Lance Taylor 03ef7571fc PR gold/12934
* target-select.cc (Target_selector::Target_selector): Add
	emulation parameter.  Change all callers.
	(select_target_by_bfd_name): Rename from select_target_by_name.
	Change all callers.
	(select_target_by_emulation): New function.
	(supported_emulation_names): New function.
	* target-select.h (class Target_selector): Add emulation_ field.
	Update declarations.
	(Target_selector::recognize_by_bfd_name): Rename from
	recognize_by_name.  Change all callers.
	(Target_selector::supported_bfd_names): Rename from
	supported_names.  Change all callers.
	(Target_selector::recognize_by_emulation): New function.
	(Target_selector::supported_emulations): New function.
	(Target_selector::emulation): New function.
	(Target_selector::do_recognize_by_bfd_name): Rename from
	do_recognize_by_name.  Change all callers.
	(Target_selector::do_supported_bfd_names): Rename from
	do_supported_names.  Change all callers.
	(Target_selector::do_recognize_by_emulation): New function.
	(Target_selector::do_supported_emulations): New function.
	(select_target_by_bfd_name): Change name in declaration.
	(select_target_by_emulation): Declare.
	(supported_emulation_names): Declare.
	* parameters.cc (parameters_force_valid_target): Try to find
	target based on emulation from -m option.
	* options.h (class General_options): Change doc string for -m.
	* options.cc (help): Print emulations.
	(General_options::parse_V): Likewise.
	* freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
	Add emulation parameter.  Change all callers.
2011-06-28 23:12:31 +00:00
Ian Lance Taylor b3ce541e97 * target.h (Target::can_check_for_function_pointers): Rewrite.
Make non-virtual.
	(Target::can_icf_inline_merge_sections): Likewise.
	(Target::section_may_have_icf_unsafe_poineters): Likewise.
	(Target::Target_info): Add can_icf_inline_merge_sections field.
	(Target::do_can_check_for_function_pointers): New virtual
	function.
	(Target::do_section_may_have_icf_unsafe_pointers): Likewise.
	* arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
	from can_check_for_function_pointers, move in file.
	(Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
	section_may_have_icf_unsafe_poineters, move in file.
	(Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
	* i386.cc (Target_i386::do_can_check_for_function_pointers):
	Rename from can_check_for_function_pointers, move in file.
	(Target_i386::can_icf_inline_merge_sections): Remove.
	(Target_i386::i386_info): Initialize
	can_icf_inline_merge_sections.
	* powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
	Initialize can_icf_inline_merge_sections.
	* sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
	* x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
	Rename from can_check_for_function_pointers, move in file.
	(Target_x86_64::can_icf_inline_merge_sections): Remove.
	(Target_x86_64::x86_64_info): Initialize
	can_icf_inline_merge_sections.
	* testsuite/testfile.cc (Target_test::test_target_info):
	Likewise.
	* icf.cc (get_section_contents): Correct formatting.
2011-06-28 21:15:42 +00:00
Doug Kwan 57eb9b5086 2011-06-27 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_relocate_functions::thm_jump8,
	Arm_relocate_functions::thm_jump11): Use a wider signed
	type to compute offset.
	* testsuite/Makefile.am: Add new tests arm_thm_jump11 and
	arm_thm_jump8.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/arm_branch_in_range.sh: Check test results of
	arm_thm_jump11 and arm_thm_jump8.
	* testsuite/arm_thm_jump11.s: New test source file.
	* testsuite/arm_thm_jump11.t: New linker script.
	* testsuite/arm_thm_jump8.s: New test source file.
	* testsuite/arm_thm_jump8.t: New linker script.
2011-06-27 17:53:32 +00:00
Doug Kwan a60af0db88 2011-06-24 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_output_section::append_text_sections_to_list): Do not
	skip empty text sections.
	* testsuite/arm_exidx_test.s: Test handling of an empty text section.
2011-06-24 16:40:34 +00:00
Doug Kwan f62a3ca731 2011-05-31 Doug Kwan <dougkwan@google.com>
Asier Llano

	PR gold/12826
	* arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
	arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
	* testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
	redundant arm_exidx_test.so.
	* testsuite/Makefile.in: Regenerate.
	(check_SCRIPTS): Add pr12826.sh
	(check_DATA): Add pr12826.stdout
	(pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
	* testsuite/pr12826.sh: New file.
	* testsuite/pr12826_1.s: Ditto.
	* testsuite/pr12826_1.s: Ditto.
2011-06-01 19:59:42 +00:00
Cary Coutant 6fa2a40bf4 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
info; adjust display of GOT entries.
	* incremental.cc (Sized_incremental_binary::setup_readers): Allocate
	vector of input objects; remove file_status_.
	(Sized_incremental_binary::do_reserve_layout): Remove file_status_.
	(Sized_incremental_binary::do_process_got_plt): Adjust calls to
	got_plt reader; call target hooks to reserve GOT entries.
	(Output_section_incremental_inputs::set_final_data_size): Adjust size
	of input file info header and GOT info entry.
	(Output_section_incremental_inputs::write_info_blocks): Write dynamic
	relocation info.
	(Got_plt_view_info::got_descriptor): Remove.
	(Got_plt_view_info::sym_index): New data member.
	(Got_plt_view_info::input_index): New data member.
	(Local_got_offset_visitor::visit): Write input file index.
	(Global_got_offset_visitor::visit): Write 0 for input file index.
	(Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
	with sym_index and input_index.
	(Output_section_incremental_inputs::write_got_plt): Adjust size of
	incremental info GOT entry; replace got_descriptor with input_index.
	(Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
	map from input file index to object.
	(Sized_relobj_incr::do_layout): Replace direct data member reference
	with accessor function.
	(Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
	* incremental.h (Incremental_input_entry_reader::get_symbol_offset):
	Adjust size of input file info header.
	(Incremental_input_entry_reader::get_first_dyn_reloc): New function.
	(Incremental_input_entry_reader::get_dyn_reloc_count): New function.
	(Incremental_input_entry_reader::get_input_section): Adjust size of
	input file info header.
	(Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
	of incremental info GOT entry.
	(Incremental_got_plt_reader::get_got_desc): Remove.
	(Incremental_got_plt_reader::get_got_symndx): New function.
	(Incremental_got_plt_reader::get_got_input_index): New function.
	(Sized_incremental_binary::Sized_incremental_binary): Remove
	file_status_; add input_objects_.
	(Sized_incremental_binary::~Sized_incremental_binary): Remove.
	(Sized_incremental_binary::set_file_is_unchanged): Remove.
	(Sized_incremental_binary::file_is_unchanged): Remove.
	(Sized_incremental_binary::set_input_object): New function.
	(Sized_incremental_binary::input_object): New function.
	(Sized_incremental_binary::file_status_): Remove.
	(Sized_incremental_binary::input_objects_): New data member.
	(Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
	references.
	(Sized_relobj_incr::invalid_address): Move to base class.
	(Sized_relobj_incr::is_output_section_offset_invalid): Move to base
	class.
	(Sized_relobj_incr::do_output_section_offset): Likewise.
	(Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
	(Sized_relobj_incr::section_offsets_): Likewise.
	* object.cc (Sized_relobj::do_for_all_local_got_entries): New
	function.
	(Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
	(Sized_relobj_file::layout_section): Replace refs to section_offsets_
	with accessor function.
	(Sized_relobj_file::do_layout): Likewise.
	(Sized_relobj_file::do_layout_deferred_sections): Likewise.
	(Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
	(Sized_relobj_file::compute_final_local_value): Replace refs to
	section_offsets_ with accessor function.
	(Sized_relobj_file::do_finalize_local_symbols): Likewise.
	* object.h (Relobj::Relobj): Initialize new data members.
	(Relobj::add_dyn_reloc): New function.
	(Relobj::first_dyn_reloc): New function.
	(Relobj::dyn_reloc_count): New function.
	(Relobj::first_dyn_reloc_): New data member.
	(Relobj::dyn_reloc_count_): New data member.
	(Sized_relobj): Rename Sized_relobj_base to this; adjust all
	references.
	(Sized_relobj::Address): New typedef.
	(Sized_relobj::invalid_address): Move here from child class.
	(Sized_relobj::Sized_relobj): Initialize new data members.
	(Sized_relobj::sized_relobj): New function.
	(Sized_relobj::is_output_section_offset_invalid): Move here from
	child class.
	(Sized_relobj::get_output_section_offset): Likewise.
	(Sized_relobj::local_has_got_offset): Likewise.
	(Sized_relobj::local_got_offset): Likewise.
	(Sized_relobj::set_local_got_offset): Likewise.
	(Sized_relobj::do_for_all_local_got_entries): Likewise.
	(Sized_relobj::clear_got_offsets): New function.
	(Sized_relobj::section_offsets): Move here from child class.
	(Sized_relobj::do_output_section_offset): Likewise.
	(Sized_relobj::do_set_section_offset): Likewise.
	(Sized_relobj::Local_got_offsets): Likewise.
	(Sized_relobj::local_got_offsets_): Likewise.
	(Sized_relobj::section_offsets_): Likewise.
	(Sized_relobj_file): Rename Sized_relobj to this; adjust all
	references.
	(Sized_relobj_file::is_output_section_offset_invalid): Move to base
	class.
	(Sized_relobj_file::sized_relobj): New function
	(Sized_relobj_file::local_has_got_offset): Move to base class.
	(Sized_relobj_file::local_got_offset): Likewise.
	(Sized_relobj_file::set_local_got_offset): Likewise.
	(Sized_relobj_file::get_output_section_offset): Likewise.
	(Sized_relobj_file::do_for_all_local_got_entries): Likewise.
	(Sized_relobj_file::do_output_section_offset): Likewise.
	(Sized_relobj_file::do_set_section_offset): Likewise.
	(Sized_relobj_file::Local_got_offsets): Likewise.
	(Sized_relobj_file::local_got_offsets_): Likewise.
	(Sized_relobj_file::section_offsets_): Likewise.
	* output.cc (Output_reloc::Output_reloc): Adjust type of relobj
	(all constructors).
	(set_needs_dynsym_index): Convert relobj to derived class pointer.
	(Output_reloc::get_symbol_index): Likewise.
	(Output_reloc::local_section_offset): Likewise.
	(Output_reloc::get_address): Likewise.
	(Output_reloc::symbol_value): Likewise.
	(Output_data_got::reserve_slot): Move to class definition.
	(Output_data_got::reserve_local): New function.
	(Output_data_got::reserve_slot_for_global): Remove.
	(Output_data_got::reserve_global): New function.
	* output.h (Output_reloc::Output_reloc): Adjust type of relobj
	(all constructors, two instantiations).
	(Output_reloc::get_relobj): New function (two instantiations).
	(Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
	(Output_data_reloc_base::add): Convert relobj to derived class pointer.
	(Output_data_reloc::add_global): Adjust type of relobj.
	(Output_data_reloc::add_global_relative): Likewise.
	(Output_data_reloc::add_symbolless_global_addend): Likewise.
	(Output_data_reloc::add_local): Likewise.
	(Output_data_reloc::add_local_relative): Likewise.
	(Output_data_reloc::add_symbolless_local_addend): Likewise.
	(Output_data_reloc::add_local_section): Likewise.
	(Output_data_reloc::add_output_section): Likewise.
	(Output_data_reloc::add_absolute): Likewise.
	(Output_data_reloc::add_target_specific): Likewise.
	(Output_data_got::reserve_slot): Move definition here.
	(Output_data_got::reserve_local): New function.
	(Output_data_got::reserve_global): New function.
	* reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
	section_offsets_ with accessor function.
	(Sized_relobj_file::write_sections): Likewise.
	(Sized_relobj_file::do_relocate_sections): Likewise.
	* target.h (Sized_target::reserve_local_got_entry): New function.
	(Sized_target::reserve_global_got_entry): New function.
	* x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
	(Target_x86_64::reserve_global_got_entry): New function.
	(Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2011-05-24 21:41:10 +00:00
Doug Kwan c87e430233 2011-04-22 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
	flag of a SHT_ARM_EXIDX section.
        * testsuite/Makefile.am (arm_exidx_test): New test rules.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/arm_exidx_test.s: New file.
	* testsuite/arm_exidx_test.sh: Same.
2011-04-22 21:50:03 +00:00
Ralf Wildenhues 9b547ce683 Fix typos in gold.
gold/:
	* dwarf_reader.cc: Remove outdated comment.
	* gold-threads.cc: Fix typo in error message.
	* archive.cc: Fix typos in comments.
	* archive.h: Likewise.
	* arm-reloc-property.cc: Likewise.
	* arm-reloc-property.h: Likewise.
	* arm-reloc.def: Likewise.
	* arm.cc: Likewise.
	* attributes.h: Likewise.
	* cref.cc: Likewise.
	* ehframe.cc: Likewise.
	* fileread.h: Likewise.
	* gold.h: Likewise.
	* i386.cc: Likewise.
	* icf.cc: Likewise.
	* incremental.h: Likewise.
	* int_encoding.cc: Likewise.
	* layout.h: Likewise.
	* main.cc: Likewise.
	* merge.h: Likewise.
	* object.cc: Likewise.
	* object.h: Likewise.
	* options.cc: Likewise.
	* readsyms.cc: Likewise.
	* reduced_debug_output.cc: Likewise.
	* reloc.cc: Likewise.
	* script-sections.cc: Likewise.
	* sparc.cc: Likewise.
	* symtab.h: Likewise.
	* target-reloc.h: Likewise.
	* target.cc: Likewise.
	* target.h: Likewise.
	* timer.cc: Likewise.
	* timer.h: Likewise.
	* x86_64.cc: Likewise.
2010-12-14 19:03:30 +00:00
Doug Kwan 017257f8db 2010-12-07 Doug Kwan <dougkwan@google.com>
* arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
	like function call relocations.
2010-12-08 05:18:54 +00:00
Richard Sandiford 95a2c8d6f7 gold/
* symtab.h (Symbol::NON_PIC_REF): Remove.
	(Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
	(Symbol::FUNCTION_CALL): Renumber.  Reword comment.
	(Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
	(Symbol::use_plt_offset): Take a flags argument and pass it
	directly to needs_dynamic_reloc.  Restrict check for undefined
	weak symbols to function calls.
	* arm.cc (Target_arm::Scan::get_reference_flags): New function.
	(Target_arm::Scan::global): Use it.
	(Target_arm::Scan::scan_reloc_for_stub): Likewise.
	(Target_arm::Relocate::relocate): Likewise.
	(Target_arm::Relocate::should_apply_static_reloc): Replace flags
	parameter with an r_type parameter.  Use get_reference_flags
	to get the flags.
	(Target_arm::Relocate::relocate): Update accordingly.
	* i386.cc (Target_i386::Scan::get_reference_flags): New function.
	(Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
	(Target_i386::Scan::global): Likewise.
	(Target_i386::Relocate::relocate): Likewise.
	(Target_i386::Relocate::should_apply_static_reloc): Replace flags
	parameter with an r_type parameter.  Use get_reference_flags
	to get the flags.
	(Target_i386::Relocate::relocate): Update accordingly.
	* powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
	(Target_powerpc::Scan::global): Use it.
	(Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
	(Target_powerpc::Relocate::relocate): Likewise.
	* sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
	(Target_sparc::Scan::global): Use it.
	(Target_sparc::Scan::scan_reloc_for_stub): Likewise.
	(Target_sparc::Relocate::relocate): Likewise.
	* x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
	(Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
	(Target_x86_64::Scan::global): Likewise.
	(Target_x86_64::Relocate::relocate): Likewise.
2010-11-11 10:43:30 +00:00
Doug Kwan f625ae503e 2010-11-08 Doug Kwan <dougkwan@google.com>
Cary Coutant  <ccoutant@google.com>

	* arm.cc (Arm_exidx_merge_section::build_contents): New method.
	(Arm_exidx_merge_section::section_contents_): New data member.
	(Arm_input_section::Arm_input_section): Initialize original_contents_.
	(Arm_input_section::~Arm_input_section): De-allocate memory.
	(Arm_input_section::original_contents_): New data member.
	(Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
	in parameters instead of calling Object::section_contents without
	locking.
	(Arm_output_section::group_section): New parameter TASK.  Pass it
	to callees that need locking objects.
	(Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
	to lock EXIDX input sections.  Fix a formatting issue.  Call
	Arm_exidx_merged_section::build_contents to create merged section
	contents.
	(Arm_output_section::create_stub_group): New parameter TASK.  Use it
	to lock object of stub table owner.
	(Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
	TEXT_SIZE to initialize data member TEXT_SIZE_.
	(Arm_exidx_input_section::addralign): Fix typo in comment.
	(Arm_exidx_input_section::text_size): New method.
	(Target_arm::do_relax): New parameter TASK.  Pass it to callees
	that require locking objects.  Lock objects before scanning for stubs
	and updating local symbols.
	(Arm_input_section<big_endian>::init): Copy contents of original
	input section.
 	(Arm_input_section<big_endian>::do_write): Use saved contents of
	original input section instead of calling Object::section_contents
	without locking.
	(Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
	size without calling Object::section_size().
	(Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
	for size.  Allocate a buffer for merged EXIDX entries.
	(Arm_exidx_merged_section::build_contents): New method.
 	(Arm_exidx_merged_section::do_write): Move merge section contents
	building code to Arm_exidx_merged_section::build_contetns.  Write
	out contetns in buffer instead of building it on the fly.
	(Arm_relobj::make_exidx_input_section): Also pass text section size
	to Arm_exidx_input_section constructor.
	(Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
	(Arm_dynobj::do_read_symbols): Fix memory leak.
	* layout.cc (Layout::finalize): Pass TASK to Target::relax().
	* target.h: (class Task): Add forward declaration.
	(Target::relax): Add new parameter TASK and pass it to
	Target::do_relax().
	(Target::do_relax):: New parameter TASK.  Fix a formatting issue.
2010-11-09 07:56:10 +00:00
Doug Kwan d06fb4d1df 2010-10-29 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
	Output_section::add_relaxed_input_section.
	* output.cc (Output_section::add_relaxed_input_section): Add new
	arguments LAYOUT and NAME.  Set section order index.
	(Output_section::convert_input_sections_in_list_to_relaxed_sections):
	Copy section order index.
	* output.h (Output_section::add_relaxed_input_section): Add new
	arguments LAYOUT and NAME.
2010-10-29 20:49:20 +00:00
Doug Kwan c9484ea5b3 2010-10-20 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
	without SHF_LINK_ORDER flags.
	* layout.cc (Layout::choose_output_section): Do not filter
	SHF_LINK_ORDER flag in a relocatable link.
2010-10-20 15:30:54 +00:00
Doug Kwan 0c91cf0457 2010-10-17 Doug Kwan <dougkwan@google.com>
* gold/arm.cc (Target_arm::got_section): Use correct order and set
	GOT output section to be writable.
2010-10-17 15:12:50 +00:00
Ian Lance Taylor 3cef717918 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
error for the deprecated relocations.
	(Target_arm::Scan::global): Likewise.
	(Target_arm::Relocate::relocate): Likewise.
2010-10-12 19:00:30 +00:00
Doug Kwan bca7fb637f 2010-09-17 Doug Kwan <dougkwan@google.com>
* arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
	defintion if relocation uses GOT entries of the symbol.
	* testsuite/icf_safe_test.sh: Fix test.
	* testsuite/icf_safe_so_test.sh: Fix test.
2010-09-17 23:51:42 +00:00
Doug Kwan aa98ff75dd 2010-09-08 Doug Kwan <dougkwan@google.com>
* 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.
2010-09-08 23:54:51 +00:00
Rafael Ávila de Espíndola 731ca54a85 2010-09-08 Rafael Espindola <espindola@google.com>
* arm.cc (do_finalize_sections): Create the __exidx_start and
	__exdix_end symbols even when the section is missing.
2010-09-08 18:31:35 +00:00
Nick Clifton ca09d69af1 * archive.cc: Formatting fixes: Remove whitespace between
typename and following asterisk.  Remove whitespace between
        function name and opening parenthesis.
        * archive.h: Likewise.
        * arm.cc: Likewise.
        * attributes.cc: Likewise.
        * attributes.h: Likewise.
        * common.cc: Likewise.
        * copy-relocs.cc: Likewise.
        * dirsearch.h: Likewise.
        * dynobj.cc: Likewise.
        * ehframe.cc: Likewise.
        * ehframe.h: Likewise.
        * expression.cc: Likewise.
        * fileread.cc: Likewise.
        * fileread.h: Likewise.
        * gc.h: Likewise.
        * gold-threads.cc: Likewise.
        * gold.cc: Likewise.
        * i386.cc: Likewise.
        * icf.h: Likewise.
        * incremental-dump.cc: Likewise.
        * incremental.cc: Likewise.
        * layout.cc: Likewise.
        * layout.h: Likewise.
        * main.cc: Likewise.
        * merge.cc: Likewise.
        * merge.h: Likewise.
        * object.cc: Likewise.
        * object.h: Likewise.
        * options.cc: Likewise.
        * options.h: Likewise.
        * output.cc: Likewise.
        * output.h: Likewise.
        * plugin.cc: Likewise.
        * plugin.h: Likewise.
        * powerpc.cc: Likewise.
        * reloc.cc: Likewise.
        * script-c.h: Likewise.
        * script-sections.cc: Likewise.
        * script.cc: Likewise.
        * stringpool.cc: Likewise.
        * symtab.cc: Likewise.
        * symtab.h: Likewise.
        * target.cc: Likewise.
        * timer.cc: Likewise.
        * timer.h: Likewise.
        * version.cc: Likewise.
        * x86_64.cc: Likewise.
2010-08-25 08:36:54 +00:00
Cary Coutant 0e70b9111a elfcpp/ChangeLog:
* elfcpp.h (enum SHT): Add SHT_GNU_INCREMENTAL_GOT_PLT.

gold/ChangeLog:

	* arm.cc (Target_arm::got_size): Add const.
	(Target_arm::got_entry_count): New function.
	(Target_arm::plt_entry_count): New function.
	(Target_arm::first_plt_entry_offset): New function.
	(Target_arm::plt_entry_size): New function.
	(Output_data_plt_arm::entry_count): New function.
	(Output_data_plt_arm::first_plt_entry_offset): New function.
	(Output_data_plt_arm::get_plt_entry_size): New function.
	* i386.cc (Target_i386::got_size): Add const.
	(Target_i386::got_entry_count): New function.
	(Target_i386::plt_entry_count): New function.
	(Target_i386::first_plt_entry_offset): New function.
	(Target_i386::plt_entry_size): New function.
	(Output_data_plt_i386::entry_count): New function.
	(Output_data_plt_i386::first_plt_entry_offset): New function.
	(Output_data_plt_i386::get_plt_entry_size): New function.
	* incremental-dump.cc (dump_incremental_inputs): Adjust call to
	find_incremental_inputs_sections.  Dump incremental_got_plt section.
	* incremental.cc: Include target.h.
	(Sized_incremental_binary::do_find_incremental_inputs_sections): Add
	parameter.  Adjust all callers.  Find incremental_got_plt section.
	(Incremental_inputs::create_data_sections): Create incremental_got_plt
	section.
	(Output_section_incremental_inputs::set_final_data_size): Calculate
	size of incremental_got_plt section.
	(Output_section_incremental_inputs::do_write): Write the
	incremental_got_plt section.
	(Got_plt_view_info): New struct.
	(Local_got_offset_visitor): New class.
	(Global_got_offset_visitor): New class.
	(Global_symbol_visitor_got_plt): New class.
	(Output_section_incremental_inputs::write_got_plt): New function.
	* incremental.h (Incremental_binary::find_incremental_inputs_sections):
	Add parameter.  Adjust all callers.
	(Incremental_binary::do_find_incremental_inputs_sections): Likewise.
	(Incremental_inputs::got_plt_section): New function.
	(Incremental_inputs::got_plt_section_): New data member.
	(Incremental_got_plt_reader): New class.
	* layout.cc (Layout::create_incremental_info_sections): Add the
	incremental_got_plt section.
	* object.h (Got_offset_list::get_list): New function.
	(Got offset_list::for_all_got_offsets): New function.
	(Sized_relobj::local_got_offset_list): New function.
	* powerpc.cc (Target_powerpc::got_size): Add const.
	(Target_powerpc::got_entry_count): New function.
	(Target_powerpc::plt_entry_count): New function.
	(Target_powerpc::first_plt_entry_offset): New function.
	(Target_powerpc::plt_entry_size): New function.
	(Output_data_plt_powerpc::entry_count): New function.
	(Output_data_plt_powerpc::first_plt_entry_offset): New function.
	(Output_data_plt_powerpc::get_plt_entry_size): New function.
	* sparc.cc (Target_sparc::got_size): Add const.
	(Target_sparc::got_entry_count): New function.
	(Target_sparc::plt_entry_count): New function.
	(Target_sparc::first_plt_entry_offset): New function.
	(Target_sparc::plt_entry_size): New function.
	(Output_data_plt_sparc::entry_count): New function.
	(Output_data_plt_sparc::first_plt_entry_offset): New function.
	(Output_data_plt_sparc::get_plt_entry_size): New function.
	* symtab.h (Symbol::got_offset_list): New function.
	(Symbol_table::for_all_symbols): New function.
	* target.h (Sized_target::got_entry_count): New function.
	(Sized_target::plt_entry_count): New function.
	(Sized_target::plt_entry_size): New function.
	* x86_64.cc (Target_x86_64::got_size): Add const.
	(Target_x86_64::got_entry_count): New function.
	(Target_x86_64::plt_entry_count): New function.
	(Target_x86_64::first_plt_entry_offset): New function.
	(Target_x86_64::plt_entry_size): New function.
	(Output_data_plt_x86_64::entry_count): New function.
	(Output_data_plt_x86_64::first_plt_entry_offset): New function.
	(Output_data_plt_x86_64::get_plt_entry_size): New function.
2010-08-12 22:15:00 +00:00
Doug Kwan ce0d197204 Index: gold/arm.cc
===================================================================
RCS file: /cvs/src/src/gold/arm.cc,v
retrieving revision 1.116
diff -u -u -p -r1.116 arm.cc
--- gold/arm.cc	3 Aug 2010 14:07:12 -0000	1.116
+++ gold/arm.cc	6 Aug 2010 07:59:30 -0000
@@ -10290,11 +10290,11 @@ Target_arm<big_endian>::merge_object_att
 	    out_attr[i].set_int_value(in_attr[i].int_value());
 	  break;
 	case elfcpp::Tag_ABI_PCS_wchar_t:
-	  // FIXME: Make it possible to turn off this warning.
 	  if (out_attr[i].int_value()
 	      && in_attr[i].int_value()
 	      && out_attr[i].int_value() != in_attr[i].int_value()
-	      && parameters->options().warn_mismatch())
+	      && parameters->options().warn_mismatch()
+	      && parameters->options().wchar_size_warning())
 	    {
 	      gold_warning(_("%s uses %u-byte wchar_t yet the output is to "
 			     "use %u-byte wchar_t; use of wchar_t values "
@@ -10315,10 +10315,10 @@ Target_arm<big_endian>::merge_object_att
 		  // Use whatever requirements the new object has.
 		  out_attr[i].set_int_value(in_attr[i].int_value());
 		}
-	      // FIXME: Make it possible to turn off this warning.
 	      else if (in_attr[i].int_value() != elfcpp::AEABI_enum_forced_wide
 		       && out_attr[i].int_value() != in_attr[i].int_value()
-		       && parameters->options().warn_mismatch())
+		       && parameters->options().warn_mismatch()
+		       && parameters->options().enum_size_warning())
 		{
 		  unsigned int in_value = in_attr[i].int_value();
 		  unsigned int out_value = out_attr[i].int_value();
Index: gold/options.h
===================================================================
RCS file: /cvs/src/src/gold/options.h,v
retrieving revision 1.147
diff -u -u -p -r1.147 options.h
--- gold/options.h	1 Jun 2010 23:37:57 -0000	1.147
+++ gold/options.h	6 Aug 2010 07:59:30 -0000
@@ -722,6 +722,10 @@ class General_options
   DEFINE_special(EL, options::ONE_DASH, '\0',
 		 N_("Link little-endian objects."), NULL);

+  DEFINE_bool(enum_size_warning, options::TWO_DASHES, '\0', true, NULL,
+	      N_("(ARM only) Do not warn about objects with incompatible "
+		 "enum sizes"));
+
   DEFINE_bool(fatal_warnings, options::TWO_DASHES, '\0', false,
 	      N_("Treat warnings as errors"),
 	      N_("Do not treat warnings as errors"));
@@ -1038,6 +1042,10 @@ class General_options
 		    N_("Report unresolved symbols as errors"),
 		    NULL, true);

+  DEFINE_bool(wchar_size_warning, options::TWO_DASHES, '\0', true, NULL,
+	      N_("(ARM only) Do not warn about objects with incompatible "
+		 "wchar_t sizes"));
+
   DEFINE_bool(whole_archive, options::TWO_DASHES, '\0', false,
               N_("Include all archive contents"),
               N_("Include only needed archive contents"));
2010-08-12 18:27:46 +00:00
Ian Lance Taylor 22f0da72ea 2010-08-03 Ian Lance Taylor <iant@google.com>
PR 11805
	* layout.h (enum Output_section_order): Define.
	(class Layout): Update declarations.
	* layout.cc (Layout::get_output_section): Add order parameter.
	Remove is_interp, is_dynamic_linker_section, 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.  Set order.
	(Layout::default_section_order): New function.
	(Layout::layout_eh_frame): Call add_output_section_to_nonload.
	* output.cc (Output_section::Output_section): Initialize order_.
	Don't initialize deleted fields.
	(Output_segment::Output_segment): Don't initialize deleted
	fields.
	(Output_segment::add_output_section_to_load): New function
	replacing add_output_section.  Change all callers to call this or
	add_output_section_to_nonload.
	(Output_segment::add_output_section_to_nonload): New function.
	(Output_segment::remove_output_section): Rewrite.
	(Output_segment::add_initial_output_data): Likewise.
	(Output_segment::has_any_data_sections): Likewise.
	(Output_segment::is_first_section_relro): Likewise.
	(Output_segment::maximum_alignment): Likewise.
	(Output_segment::has_dynamic_reloc): New function replacing
	dynamic_reloc_count.  Change all callers.
	(Output_segment::has_dynamic_reloc_list): New function replacing
	dynamic_reloc_count_list.  Change all callers.
	(Output_segment::set_section_addresses): Rewrite.
	(Output_segment::set_offset): Rewrite.
	(Output_segment::find_first_and_last_list): Remove.
	(Output_segment::set_tls_offsets): Rewrite.
	(Output_segment::first_section_load_address): Likewise.
	(Output_segment::output_section_count): Likewise.
	(Output_segment::section_with_lowest_load_address): Likewise.
	(Output_segment::write_section_headers): Likewise.
	(Output_segment::print_sections_to_map): Likewise.
	* output.h (class Output_data): Remove dynamic_reloc_count_
	field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
	(Output_data::add_dynamic_reloc): Rewrite.
	(Output_data::has_dynamic_reloc): New function.
	(Output_data::dynamic_reloc_count): Remove.
	(class Output_section): Add order_ field.  Remvoe is_relro_local_,
	is_last_relro_, is_first_non_relro_, is_interp_,
	is_dynamic_linker_section_ fields.  Add order and set_order
	functions.  Remove is_relro_local, set_is_relro_local,
	is_last_relro, set_is_last_relro, is_first_non_relro,
	set_is_first_non_relro functions, is_interp, set_is_interp,
	is_dynamic_linker_section, and set_is_dynamic_linker_section
	functions.
	(class Output_segment): Change Output_data_list from std::list to
	std:;vector.  Add output_lists_ field.  Remove output_data_ and
	output_bss_ fields.  Update declarations.
2010-08-03 14:07:13 +00:00
Ian Lance Taylor 3ff2ccb075 * arm.cc (Target_arm::gc_process_relocs): Use typename.
* powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
	* sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2010-08-02 20:44:31 +00:00
Sriraman Tallam 41cbeecc3c * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
paramter to the call to gold::gc_process_relocs.
	* i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
	paramter to the call to gold::gc_process_relocs.
	* x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
	parameter to the call to gold::gc_process_relocs.
	* powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
	template parameter to the call to gold::gc_process_relocs.
	* sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
	paramter to the call to gold::gc_process_relocs.
	* gc.h (get_embedded_addend_size): New function.
	(gc_process_relocs): Save the size of the reloc for use by ICF.
	* icf.cc (get_section_contents): Get the addend from the text section
	for SHT_REL relocation sections.
	* icf.h (Icf::Reloc_addend_size_info): New typedef.
	(Icf::Reloc_info): Add new member reloc_addend_size_info.
	* int_encoding.h (read_from_pointer): New overloaded function.
	* testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
	* testsuite/icf_sht_rel_addend_test.sh: New file.
	* testsuite/icf_sht_rel_addend_test_1.cc: New file.
	* testsuite/icf_sht_rel_addend_test_2.cc: New file.
2010-07-29 18:57:28 +00:00
Doug Kwan 131687b4ad 2010-07-13 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_input_section::Arm_input_section): For a
	SHT_ARM_EXIDX section, always keeps the input sections.
	(Arm_input_section::set_exidx_section_link): New method.
	(Arm_exidx_input_section::Arm_exidx_input_section): Initialize
	has_errors_ to false.
	(Arm_exidx_input_section::has_errors,
	Arm_exidx_input_section::set_has_errors): New methods.
	(Arm_exidx_input_section::has_errors_): New data member.
	(Arm_relobj::get_exidx_shndx_list): New method.
	(Arm_output_section::append_text_sections_to_list): Do not skip
	section without SHF_EXECINSTR.
	(Arm_output_section::fix_exidx_coverage): Skip input sections with
	errors.
 	(Arm_relobj::make_exidx_input_section): Add new parameter for text
	section header.  Make error messages more verbose.  Check for
	a non-executable section linked to an EXIDX section.
	(Arm_relobj::do_read_symbols): Remove error checking, which has been
	moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
	check that there is no deferred EXIDX section if we exit early.
	Instead of not making an EXIDX section in case of an error, make one
	and set the has_errors flag of it.
	(Target_arm::do_finalize_sections): Fix up links of EXIDX sections
	in a relocatable link.
	(Target_arm::do_relax): Look for the EXIDX output section instead of
	assuming that it is called .ARM.exidx.
 	(Target_arm::fix_exidx_coverage): Add a new parameter for input
	section list.  Do not check for SHF_EXECINSTR section flags but
	skip any input section with errors.
	* output.cc (Output_section::Output_section): Initialize
	always_keeps_input_sections_ to false.
	(Output_section::add_input_section): Check for
	always_keeps_input_sections_.
	*  output.h (Output_section::always_keeps_input_sections,
	Output_section::set_always_keeps_input_sections): New methods.
	(Output_section::always_keeps_input_sections): New data member.
2010-07-13 20:07:08 +00:00
Ian Lance Taylor 8274239589 * output.h (Output_section_lookup_maps::add_merge_section):
Correct check of whether value was inserted.
	(Output_section_lookup_maps::add_merge_input_section): Likewise.
	(Output_section_lookup_maps::add_relaxed_input_section):
	Likewise.
	* arm.cc (Target_arm::got_section): Remove used local os.
	* i386.cc (Target_i386::got_section): Likewise.
	* x86_64.cc (Target_x86_64::got_section): Likewise.
	* sparc.cc (Target_sparc::got_section): Likewise.
	(Target_sparc::relocate): Remove unused local have_got_offset.
	* powerpc.cc (Target_powerpc::relocate): Likewise.
2010-07-13 12:04:03 +00:00
Doug Kwan b2286c10fe 2010-06-29 Doug Kwan <dougkwan@google.com>
* arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
	Initialize USE_SYMBOL_.
	* arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
	definition.
	(Arm_reloc_property::uses_symbol_): New data member declaration.
	* arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
	uses symbol value and symbol is undefined but not weakly undefined.
2010-06-30 06:41:09 +00:00
Doug Kwan 8a75a161b2 2010-06-25 Doug Kwan <dougkwan@google.com>
* arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
	(Target_arm::section_may_have_icf_unsafe_pointers): New method
	definition.
	(Target_arm::Scan::local_reloc_may_be_function_pointer,
	Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
	target hook to detect function points.
	(Target_arm::Scan::possible_function_pointer_reloc): New method.
	* icf.h (Icf::check_section_for_function_pointers): Change type of
	parameter SECTION_NAME to const reference to std::string.  Use
	target hook to determine if section may have unsafe pointers.
	* target.h (Target::section_may_have_icf_unsafe_pointers): New
	method definition.
2010-06-25 00:37:40 +00:00
Doug Kwan 3e23530232 2010-06-16 Doug Kwan <dougkwan@google.com>
* arm.cc (Target_arm::do_finalize_sections): Do not emit an
	.ARM.attributes section if we have not merged any input
	attributes sections.
2010-06-16 18:19:18 +00:00
Doug Kwan 106e8a6ca6 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
* arm.cc: Allow combining objects with no EABI version
        information.
2010-06-15 23:51:51 +00:00
Doug Kwan 25bbe950ab 2010-06-07 Doug Kwan <dougkwan@google.com>
* arm.cc (Target_arm::do_relax): Reserve more space for stubs.
	Restrict stub-group size to be within long conditional branch
	range when working around cortex-A8 erratum.
2010-06-08 00:33:41 +00:00
Doug Kwan 5c3885291f 2010-05-26 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_scan_relocatable_relocs): New class.
	(Target_arm::relocate_special_relocatable): New method.
	(Arm_relocate_functions::arm_branch_common): Handle relocatable link.
	(Arm_relocate_functions::thumb_branch_common): Same.
	(Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
	instead of Default_scan_relocatable_relocs.
	* target-reloc.h (relocate_for_relocatable): Let target handle
	relocation strategy Relocatable_relocs::RELOC_SPECIAL.
	* target.h (Sized_target::relocate_special_relocatable): New method.
2010-05-26 03:33:59 +00:00
Doug Kwan 0439c7962a 2010-05-23 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_input_section::do_output_offset): Use convert_types
	instead of a cast.
	(Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
	with a direct branch, not a conditional branch, to a stub.
	* merge.cc (Output_merge_base::record_input_section): New method
	defintion.
	(Output_merge_data::do_add_input_section): Record input section if
	keeps-input-sections flag is set.
	(Output_merge_string::do_add_input_section): Ditto.
	* merge.h (Output_merge_base::Output_merge_base): Initialize new data
	members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
	INPUT_SECTIONS_.
	(Output_merge_base::keeps_input_sections,
	Output_merge_base::set_keeps_input_sections,
	Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
	method definitions.
	(Output_merge_base::Input_sections): New type declaration.
	(Output_merge_base::input_sections_begin,
	Output_merge_base::input_sections_end,
	Output_merge_base::do_set_keeps_input_sections): New method definitions.
	(Output_merge_base::bool keeps_input_sections_,
	Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
	Output_merge_base::input_sections_): New data members.
	(Output_merge_data::do_set_keeps_input_sections): New method
	defintion.
	(Output_merge_string::do_set_keeps_input_sections): Ditto.
	* output.cc (Output_section::Input_section::relobj): Move method
	defintion from class declaration to here and handle merge sections.
	(Output_section::Input_section::shndx): Ditto.
	(Output_section::Output_section): Remove initializations of removed
	data members and initialize new data member LOOKUP_MAPS_.
	(Output_section::add_input_section): Set keeps-input-sections flag
	for a newly created merge output section as appropriate.  Adjust code
	to use Output_section_lookup_maps class.
	(Output_section::add_relaxed_input_section): Adjst code for lookup
	maps code refactoring.
 	(Output_section::add_merge_input_section): Add a new parameter
	KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
	class.  If adding input section to a newly created merge output
	section fails, remove the new merge section.
	(Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
	Adjust code for use of the Output_section_lookup_maps class.
 	(Output_section::find_merge_section): Ditto.
	(Output_section::build_lookup_maps): New method defintion.
 	(Output_section::find_relaxed_input_section): Adjust code to use
	Output_section_lookup_maps class.
	(Output_section::get_input_sections): Export merge sections.  Adjust
	code to use Output_section_lookup_maps class.
	(Output_section:::add_script_input_section): Adjust code to use
	Output_section_lookup_maps class.  Update lookup maps for merge
	sections also.
	(Output_section::discard_states): Use Output_section_lookup_maps.
	(Output_section::restore_states): Same.
	* output.h (Merge_section_properties): Move class defintion out of
	Output_section.
	(Output_section_lookup_maps): New class.
	(Output_section::Input_section::is_merge_section): New method
	defintion.
	(Output_section::Input_section::relobj): Move defintion out of class
	defintion.  Declare method only.
	(Output_section::Input_section::shndx): Ditto.
	(Output_section::Input_section::output_merge_base): New method defintion.
     	(Output_section::Input_section::u2_.pomb): New union field.
	(Output_section::Merge_section_by_properties_map,
	Output_section::Output_section_data_by_input_section_map,
	Output_section::Ouptut_relaxed_input_section_by_input_section_map):
	Remove types.
   	(Output_section::add_merge_input_section): Add new parameter
	KEEPS_INPUT_SECTIONS.
	(Output_section::build_lookup_maps): New method declaration.
	(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_): Remove data
	members.
	(Output_section::lookup_maps_): New data member.
2010-05-23 07:43:39 +00:00
H.J. Lu 7629558884 Add a cast to avoid a compilation error.
2010-05-21  Doug Kwan  <dougkwan@google.com>

	PR gold/11619
	* arm.cc (Arm_input_section::do_output_offset): Add a cast to
	avoid a compilation error.
2010-05-22 01:06:49 +00:00
Doug Kwan 6625d24e23 2010-05-14 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_input_section::original_size): New method.
	(Arm_input_section::do_addralign): Add a cast.
	(Arm_input_section::do_output_offset): Remove static cast.
	(Arm_input_section::original_addralign,
	 Arm_input_section::original_size_): Change type to uint32_t.
	(Arm_input_section::init): Add safe casts for section alignment
	and size.
	(Arm_input_section::set_final_data_size): Do not set address and
	offset of stub table.
	(Arm_output_section::fix_exidx_coverage): Change use of of
	Output_section::Simple_input_section to that of
	Output_section::Input_section.
	(Target_arm::do_relax): Set addresses and file offsets of Stub_tables
	except for the first pass.
	* output.cc (Output_section::get_input_sections): Change type of
	input_sections to std::list<Input_section>.
	(Output_section::add_script_input_section): Rename from
	Output_section::add_simple_input_section.  Change type of SIS
	parameter from Simple_input_section to Input_section.
	* output.h (Output_section::Simple_input_section): Remove class.
	(Output_section::Input_section): Change class visibility to public.
	(Output_section::Input_section::addralign): Use stored alignments
	for special input sections if set.
	(Output_section::Input_section::set_addralign): New method.
	(Output_section::get_input_sections): Change parameter type from
	list of Simple_input_section to list of Input_section.
	(Output_section::add_script_input_section): Rename from
	Output_section::add_simple_input_section. Change first parameter's
	type from Simple_input_section to Input_section and remove the
	second and third parameters.
	* script-sections.cc (Input_section::Input_section_list): Change
	type to list of Output_section::Input_section/
	(Input_section_info::Input_section_info): Change parameter type of
	INPUT_SECTION to Output_section::Input_section.
	(Input_section_info::input_section): Change return type.
	(Input_section_info::input_section_): Change type to
	Output_section::Input_section.
	(Output_section_element_input::set_section_addresses): Adjust code
	to use Output_section::Input_section instead of
	Output_section::Simple_input_section.  Adjust code for renaming
	of Output_section::add_simple_input_section.
	(Orphan_output_section::set_section_addresses): Ditto.
2010-05-19 07:09:36 +00:00
Doug Kwan da59ad79a2 2010-05-12 Doug Kwan <dougkwan@google.com>
elfcpp/ChangeLog

	* arm.h (Tag_FP_arch, Tag_ABI_align_needed, Tag_ABI_align_preserved,
	Tag_FP_HP_extension, Tag_MPextension_use_legacy): Rename from
	existing tags.
	(Tag_undefined40, Tag_undefined41, Tag_MPextension_use,
	Tag_undefined43): New tags.
	(Targ_VFP_arch, Tag_ABI_align8_needed, TAG_ABI_align8_preserved,
	Tag_VFP_HP_extension): Define aliases for backward compatiblity.

gold/ChangeLog

	* arm.cc (Target_arm::do_finalize_sections): Create an empty
	attributes section only if there no attributes section after merging.
	(Target_arm::merge_object_attributes): Move value of
	Tag_MPextension_use_legacy to that of Tag_MPextension_use.
	Handle Tag_DIV_use and Tag_MPextension_use_legacy.
	* testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
	(check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
	and arm_attr_merge_7.stdout.
	(arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
	arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
	arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
	arm_attr_merge_7b.o): New rules.
	(MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
	arm_attr_merge_7
	* testsuite/Makefile.in: Regenerate.
	* testsuite/arm_attr_merge.sh: New file.
	* testsuite/arm_attr_merge_[67][ab].s: Same.
2010-05-13 02:41:15 +00:00
Andrew Haley 85fdf9067f 2010-04-15 Andrew Haley <aph@redhat.com>
* emultempl/armelf.em (merge_exidx_entries): New variable.
	(OPTION_NO_MERGE_EXIDX_ENTRIES): New definition.
	("no-merge-exidx-entries"): New option.
	* ld.texinfo (merge-exidx-entries): Document this option.

2010-04-15  Andrew Haley  <aph@redhat.com>

	* bfd-in.h (elf32_arm_fix_exidx_coverage): Add new flag:
	merge_exidx_entries.
	* bfd-in2.h: Likewise.
	* elf32-arm.c (elf32_arm_fix_exidx_coverage): Likewise.  Use it to
	control merging of exidx entries.

2010-04-15  Andrew Haley  <aph@redhat.com>

	* options.h (merge_exidx_entries): New option.
	* arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
	(class Arm_exidx_fixup::merge_exidx_entries_): New member.
	(Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
	(Target_arm::merge_exidx_entries): New function.
	(process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
	(Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
	to Arm_exidx_fixup constructor.
	Add new arg, merge_exidx_entries.
	(Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
	Arm_output_section::fix_exidx_coverage.
2010-04-21 16:32:31 +00:00
Doug Kwan 04ceb17cc3 2010-04-14 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
	for local symbol recounting if we remove a section due to ICF.
	* gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
	there are no regular objects in input.
2010-04-15 00:42:15 +00:00
Doug Kwan 153e7da4fc 2010-04-13 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_input_section::set_final_data_size): Compute
	accurate final data size instead of using current data size.
2010-04-13 20:37:55 +00:00
Doug Kwan 24af6f9228 2010-04-07 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
	if section is marked as containing instructions but has no mapping
	symbols.
	(Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
	correct section index.
	(Arm_relobj::find_linked_text_section): Ditto.
2010-04-08 06:56:15 +00:00
Doug Kwan 7296d93387 2010-04-07 Doug Kwan <dougkwan@google.com>
* arm.cc: Replace "endianity" with "endianness" in comments.
	(Arm_exidx_cantunwind): Ditto.
	(Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
	(Arm_relobj::merge_flags_and_attributes): New method.
	(Arm_relobj::merge_flags_and_attributes_): New data member.
	(Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
	(Arm_relobj::scan_sections_for_stubs): Ditto.
	(Arm_relobj::do_read_symbols): Check to see if we really want to
	merge processor-specific flags and attributes.  Exit early if
	an object is empty except for section names and the undefined symbol.
	(Target_arm::do_finalize_sections): Move check for ELF format to
	Arm_relobj::do_read_symbols.  Merge processor specific flags and
	attributes from a regular object only when we have determined that
	it is aapropriate.  Do not create an .ARM.attributes section in
	output if there is no regular input object.
	(Target_arm::merge_processor_specific_flags): Check
	--warn-mismatch before printing any error.
	(Target_arm::merge_object_attributes): Ditto.
	* gold.cc (queue_middle_tasks): Handle the case in which there is
	no regular object in input.
	* options.cc (General_options::parse_EB): New method.
	(General_options::parse_EL): Same.
	(General_options::General_options): Initialize endianness_.
	* options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
	New options.
	(General_options::Endianness): New enum.
	(General_options::endianness): New method.
	(General_options::endianness_): New data member.
	* parameters.cc (Parameters::set_options): Check target endianness.
	(Parameters::set_target_once): Ditto.
	(Parameters::check_target_endianness): New method.
	(parameters_force_valid_target): If either -EL or -EB is specified,
	use it to define endianness of default target.
	* parameters.h (Parameters::check_target_endianness): New method
	declaration.
	* target.h (class Target): Change "endianity" to "endianness"
	in comments.
2010-04-07 21:42:22 +00:00
Doug Kwan 323c532fae 2010-03-30 Doug Kwan <dougkwan@google.com>
* arm.cc (Target_arm::using_thumb_only): Handle v6-M
2010-03-31 06:05:37 +00:00
Doug Kwan 4fcd97eb15 2010-03-25 Doug Kwan <dougkwan@google.com>
* gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
	to avoid a conversion warning on a 32-bit host.
2010-03-26 04:53:34 +00:00
Doug Kwan a2c7281b72 2010-03-22 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_relocate_functions::abs8,
	Arm_relocate_functions::abs16): Use correct check for overflow
	specified in the ARM ELF specs.
	(Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
	target of a BLX instruction specially.
	(Reloc_stub::stub_type_for_reloc): Ditto.
	(Relocate::relocate): Use symbolic names instead of numeric relocation
	codes to report error.
	(Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
	workaround.
	* testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
	thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
	thumb2_blx_out_of_range.stdout
	(thumb_bl_out_of_range, thumb_bl_out_of_range.o,
	thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
	(thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
	thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
	thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
	thumb2_blx_in_range, thumb2_blx_in_range.o,
	thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
	thumb2_blx_out_of_range.o): New rules.
 	(MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
	thumb2_blx_in_range and	thumb2_blx_out_of_range.
	* testsuite/Makefile.in: Regenerate.
	* arm_branch_in_range.sh: Add tests for THUMB BLX.
	* testsuite/thumb_blx_in_range.s: New file.
	* testsuite/thumb_blx_out_of_range.s: New file.
2010-03-22 22:48:05 +00:00
Doug Kwan d099120c64 2010-03-19 Doug Kwan <dougkwan@google.com>
* arm.cc (Stub_table::Stub_table): Initialize new data members
	Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
	(Stub_table::add_reloc_stub): Assign stub offset and update
	Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
	(Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
	New data members.
 	(Stub_table::update_data_size_and_addralign): Use
	Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
	instead of going over all reloc stubs.
 	(Stub_table::finalize_stubs): Do not assign reloc stub offsets.
	* stringpool.cc (Stringpool_template::Stringpool_template): Initialize
	Stringpool_template::offset_ to size of Stringpool_char.
 	(Stringpool_template::new_key_offset): Remove code to initialize
	Stringpool_template::offset_.
	* stringpool.h (Stringpool_template::set_no_zero_null): Set
	Stringpool_template::offset_ to zero.
2010-03-19 19:11:21 +00:00
Doug Kwan 9177756dc9 2010-03-08 Doug Kwan <dougkwan@google.com>
* gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
	due to a conversion warning.
	(Arm_relobj::update_output_local_symbol_count): Check for local
	symbol with unset output index.
2010-03-08 22:15:16 +00:00
Ian Lance Taylor d3bbad6265 * target-reloc.h (relocate_section): Check the symbol table index
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.
2010-03-03 19:31:54 +00:00
Doug Kwan c3e4ae2903 2010-02-26 Doug Kwan <dougkwan@google.com>
* arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
	R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
	* testsuite/debug_msg.sh: Avoid matching source line number for
	use of global variable undef_int.
2010-02-27 00:46:00 +00:00
Doug Kwan 2fd9ae7a1d 2010-02-26 Doug Kwan <dougkwan@google.com>
* arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
	R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
	(Target_arm::scan_reloc_section_for_stubs): Instead of calling
	scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
	* options.cc (General_options::General_options): Initialize member
	fix_v4bx_.
	* testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
	(check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
	and rm_no_fix_v4bx.stdout
	(arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
	arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
	arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
	(MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
	and arm_no_fix_v4bx.
	* Makefile.in: Regenerate.
	* testsuite/arm_fix_v4bx.s: New file.
	* testsuite/arm_fix_v4bx.sh: Ditto.
2010-02-27 00:36:49 +00:00
Doug Kwan 67ec7d0b4d 2010-02-24 Doug Kwan <dougkwan@google.com>
* arm.cc (Target_arm::got_section): Make the .got section the first
	non RELRO section in the data segment.
	* testsuite/script_test_5.sh: Fix match patterns to avoid matching
	suffixes of section names.
2010-02-25 05:11:26 +00:00
Doug Kwan 101654612f 2010-02-24 Doug Kwan <dougkwan@google.com>
* arm.cc (Target_arm::do_finalize_sections): Skip processor specific
	flags and attributes merging if an input file is a binary file.
	* fileread.cc (Input_file::open): Record format of original file.
	* fileread.h (Input_file::Format): New enum type.
   	(Input_file::Input_file): Initialize data member format_.
	(Input_file::format): New method definition.
	(Input_file::format_):: New data member.
2010-02-24 20:50:59 +00:00
Doug Kwan 4a54abbbe9 2010-02-24 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_output_data_got): New class.
	(ARM_TCB_SIZE): New constant
	(Target_arm): Use Arm_output_data_got instead of Output_data_got.
	(Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
	If user uses a script with a SECTIONS clause, issue only a warning
	for a misplaced EXIDX input section.  Otherwise, issue an error.
 	(Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
	garbage collection.
	(Target_arm::got_mode_index_entry): Handle static linking.
	(Target_arm::Scan::local): Ditto.
	(Target_arm::Scan::global): Ditto.
	(Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
	all incorrectly implemented relocations.
	(Target_arm::fix_exidx_coverage): Pass layout to
	Arm_output_section::fix_exidx_coverage.
	* layout.cc (Layout::section_name_mapping): Remove trailing dots
	from ".ARM.exidx." and ".ARM.extab.".
2010-02-24 20:45:12 +00:00
Ian Lance Taylor ca419a6f33 * arm.cc (Target_arm::do_finalize_sections): Create attribute
section if it does not already exist.
	* attributes.cc	(Attributes_section_data::Attributes_section_data):
	Don't crash if size is zero.
2010-02-23 17:45:38 +00:00
Doug Kwan 2a2b6d42b1 2010-02-21 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
	handling of the maximum backward branch offset.
     	(Arm_relocate_functions::thumb_branch_common): Ditto.
	* testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
	(check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
	thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
	thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
	(arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
	arm_bl_out_of_range.stdout, arm_bl_out_of_range,
	arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
	thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
	thumb_bl_out_of_range thumb_bl_out_of_range.o,
	thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
	thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
	thumb2_bl_out_of_range.o): New rules.
	(MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
	thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
	thumb2_bl_out_of_range
	* testsuite/Makefile.in: Regenerate.
	* testsuite/arm_bl_in_range.s: New file.
	* testsuite/arm_bl_out_of_range.s: Ditto.
	* testsuite/arm_branch_in_range.sh: Ditto.
	* testsuite/arm_branch_range.t: Ditto.
	* testsuite/thumb2_branch_range.t: Ditto.
	* testsuite/thumb_bl_in_range.s: Ditto.
	* testsuite/thumb_bl_out_of_range.s: Ditto.
	* testsuite/thumb_branch_range.t: Ditto.
2010-02-22 06:26:07 +00:00
Doug Kwan f96accdf2b 2010-02-18 Doug Kwan <dougkwan@google.com>
* arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
	R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
	* arm.cc (Arm_relocation_functions): New forward declaration.
	(Target_arm::Target_arm): Initialize new data members
	got_mod_index_offset_ and tls_base_symbol_defined_.
	(Target_arm::Relocate::relocate_tls): New method.
	(Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
	 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
	New methods.
   	(Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
	GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
	(Target_arm::got_mod_index_offset_,
	Target_arm::tls_base_symbol_defined_): New data members.
	(Target_arm::Scan::local, Target::Scan::global,
	Target_arm::Relocate::relocate): Handle 32-bit initial TLS
	relocations.
2010-02-19 22:53:54 +00:00
Doug Kwan c8761b9af4 2010-02-18 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_relobj::find_linked_text_section): New method.
	(Arm_relobj::make_exidx_input_section): Pass section index of linked
	text section as a parameter becuase some broken tools may not set
	the link in section header.
	(Target_arm::has_got_section): New method.
	(Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
	without any mapping symbol as data only.  Remove warning.
	(Arm_relobj::do_read_synbols): If an EXIDX input section has no
	link in its section header, try to discover the link by inspecting the
	REL31 relocation at the beginning of the section.
	(Target_arm::Scan::check_non_pic): Report name of offending relocation
	in error message.
	(Target_arm::Scan::global): Treat any reference to the symbol
	_GLOBAL_OFFSET_TABLE_ as a GOT access.
2010-02-19 02:16:41 +00:00
Sriraman Tallam 21bb3914d6 2010-02-12 Sriraman Tallam <tmsriram@google.com>
* 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-13 02:04:21 +00:00
Doug Kwan e4782e8381 2010-02-11 Doug Kwan <dougkwan@google.com>
* 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-12 05:51:32 +00:00
David S. Miller 612a8d3dbf * output.h (Output_data_dynamic::add_section_size): New method
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-09 20:29:44 +00:00
Doug Kwan cb1be87e23 2010-02-08 Doug Kwan <dougkwan@google.com>
* 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-09 06:46:00 +00:00
Doug Kwan cf846138ae 2010-02-05 Doug Kwan <dougkwan@google.com>
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-06 04:30:00 +00:00
Doug Kwan 5c57f1be7b 2010-02-03 Doug Kwan <dougkwan@google.com>
* 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-04 03:32:18 +00:00
Doug Kwan 218c583182 2010-02-03 Doug Kwan <dougkwan@google.com>
* arm.cc (Target_arm::relocate_section): Do view adjustment for all
	types of relaxed input section.
2010-02-03 19:32:28 +00:00
Doug Kwan 0d31c79dad 2010-02-02 Doug Kwan <dougkwan@google.com>
* 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-03 05:36:55 +00:00
Doug Kwan 546c74577f 2010-02-01 Doug Kwan <dougkwan@google.com>
* 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-02-02 00:25:57 +00:00
Doug Kwan 11b861d510 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
* 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-30 00:11:00 +00:00
Doug Kwan c9a2c12554 2010-01-29 Doug Kwan <dougkwan@google.com>
* arm.cc (Target_arm::Scan::global): General PLTs for the same set
	of relocation types as ld.
2010-01-30 00:01:12 +00:00
Doug Kwan 1521477a53 2010-01-29 Doug Kwan <dougkwan@google.com>
* 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-29 22:16:17 +00:00
Doug Kwan e7eca48cb2 2010-01-29 Doug Kwan <dougkwan@google.com>
* 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 18:23:18 +00:00
Ian Lance Taylor 02961d7edf * arm.cc: Added support for the ARM relocations:
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-29 15:46:43 +00:00
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