Commit Graph

164 Commits

Author SHA1 Message Date
Ian Lance Taylor c2a122b635 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
(Arm_relocate_functions::movt_prel): New function.
	(Arm_relocate_functions::thm_movw_prel_nc): New function.
	(Arm_relocate_functions::thm_movt_prel): New function.
	(Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
	R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
	(Scan::global, Relocate::relocate): Likewise.
	(Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2009-10-09 22:45:13 +00:00
Ian Lance Taylor fd3c5f0b49 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
New function.
	(Arm_relocate_functions::insert_val_arm_movw_movt): New function.
	(Arm_relocate_functions::extract_thumb_movw_movt_addend): New
	function.
	(Arm_relocate_functions::insert_val_thumb_movw_movt): New
	function.
	(Arm_relocate_functions::movw_abs_nc): New function.
	(Arm_relocate_functions::movt_abs): New function.
	(Arm_relocate_functions::thm_movw_abs_nc): New function.
	(Arm_relocate_functions::thm_movt_abs): New function.
	(Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
	R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
	(Scan::global): Likewise.
	(Relocate::relocate): Likewise.
	(Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2009-10-07 15:41:50 +00:00
Ian Lance Taylor 7f5309a5cc * arm.cc (Arm_relocate_functions::got_prel) New function.
(Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
	(Relocate::relocate): Likewise.
	(Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2009-10-07 15:30:40 +00:00
Ian Lance Taylor 364c7fa5c9 * options.h (class General_options): Define
split_stack_adjust_size parameter.
	* object.h (class Object): Add uses_split_stack_ and
	has_no_split_stack_ fields.  Add uses_split_stack and
	has_no_split_stack accessor functions.  Declare
	handle_split_stack_section.
	(class Reloc_symbol_changes): Define.
	(class Sized_relobj): Define Function_offsets.  Declare
	split_stack_adjust, split_stack_adjust_reltype, and
	find_functions.
	* object.cc (Object::handle_split_stack_section): New function.
	(Sized_relobj::do_layout): Call handle_split_stack_section.
	* dynobj.cc (Sized_dynobj::do_layout): Call
	handle_split_stack_section.
	* reloc.cc (Sized_relobj::relocate_sections): Call
	split_stack_adjust for executable sections in split_stack
	objects.  Pass reloc_map to relocate_section.
	(Sized_relobj::split_stack_adjust): New function.
	(Sized_relobj::split_stack_adjust_reltype): New function.
	(Sized_relobj::find_functions): New function.
	* target-reloc.h: Include "object.h".
	(relocate_section): Add reloc_symbol_changes parameter.  Change
	all callers.
	* target.h (class Target): Add calls_non_split method.  Declare
	do_calls_non_split virtual method.  Declare match_view and
	set_view_to_nop.
	* target.cc: Include "elfcpp.h".
	(Target::do_calls_non_split): New function.
	(Target::match_view): New function.
	(Target::set_view_to_nop): New function.
	* gold.cc (queue_middle_tasks): Give an error if mixing
	split-stack and non-split-stack objects with -r.
	* i386.cc (Target_i386::relocate_section): Add
	reloc_symbol_changes parameter.
	(Target_i386::do_calls_non_split): New function.
	* x86_64.cc (Target_x86_64::relocate_section): Add
	reloc_symbol_changes parameter.
	(Target_x86_64::do_calls_non_split): New function.
	* arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
	parameter.
	* powerpc.cc (Target_powerpc::relocate_section): Add
	reloc_symbol_changes parameter.
	* sparc.cc (Target_sparc::relocate_section): Add
	reloc_symbol_changes parameter.
	* configure.ac: Call AM_CONDITIONAL for the default target.
	* configure: Rebuild.
	* testsuite/Makefile.am (TEST_AS): New variable.
	(check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
	(check_DATA): Add split_i386 and split_x86_64 files.
	(SPLIT_DEFSYMS): Define.
	(split_i386_[1234n].o): New targets.
	(split_i386_[124]): New targets.
	(split_i386_[1234r].stdout): New targets.
	(split_x86_64_[1234n].o): New targets.
	(split_x86_64_[124]): New targets.
	(split_x86_64_[1234r].stdout): New targets.
	(MOSTLYCLEANFILES): Add new executables.
	* testsuite/split_i386.sh: New file.
	* testsuite/split_x86_64.sh: New file.
	* testsuite/split_i386_1.s: New file.
	* testsuite/split_i386_2.s: New file.
	* testsuite/split_i386_3.s: New file.
	* testsuite/split_i386_4.s: New file.
	* testsuite/split_i386_n.s: New file.
	* testsuite/split_x86_64_1.s: New file.
	* testsuite/split_x86_64_2.s: New file.
	* testsuite/split_x86_64_3.s: New file.
	* testsuite/split_x86_64_4.s: New file.
	* testsuite/split_x86_64_n.s: New file.
	* testsuite/testfile.cc (Target_test): Update relocation_section
	function.
	* testsuite/Makefile.in: Rebuild.
2009-10-06 22:58:27 +00:00
Doug Kwan 966d409744 2009-09-30 Doug Kwan <dougkwan@google.com>
* arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
	symbol and call Symbol::may_need_copy_reloc to determine if
	a copy reloc is needed.
	* copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
	nocopyreloc is given in command line.
	(Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
	given in command line.
	* i386.cc (Target_i386::may_need_copy_reloc): Remove.
	(Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
	of the removed Target_i386::may_need_copy_reloc.
	* options.h (copyreloc): New option with default value false.
	* powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
	(Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
	instead of the removed Target_powerpc::may_need_copy_reloc.
	* sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
	(Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
	instead of the removed Target_sparc::may_need_copy_reloc.
	* symtab.h (Symbol::may_need_copy_reloc): New method definition.
	* x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
	(Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
	instead of the removed Target_x86_64::may_need_copy_reloc.
2009-10-01 00:58:38 +00:00
Ian Lance Taylor 5e445df679 * arm.cc (has_signed_unsigned_overflow): New function.
(Arm_relocate_functions::abs8): New function.
	(Target_arm::Scan::local): Handle R_ARM_ABS8.
	(Target_arm::Scan::global): Likewise.
	(Target_arm::relocate::relocate): Likewise.
	(Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
	Likewise.
2009-09-18 00:45:53 +00:00
Doug Kwan 11af873fca 2009-08-11 Doug Kwan <dougkwan@google.com>
* arm.cc: Update comments.
	(Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
	segment to locate the .ARM.exidx section if present.
2009-08-11 17:09:14 +00:00
Ian Lance Taylor 8a5e3e08a6 * layout.cc (Layout::make_output_section): Call
Target::new_output_section.
	(Layout::attach_allocated_section_to_segment): Put large section
	sections in a separate load segment with the large segment flag
	set.
	(Layout::segment_precedes): Sort large data segments after other
	load segments.
	(align_file_offset): New static function.
	(Layout::set_segment_offsets): Use align_file_offset.
	* output.h (class Output_section): Add is_small_section_ and
	is_large_section_ fields.
	(Output_section::is_small_section): New function.
	(Output_section::set_is_small_section):  New function.
	(Output_section::is_large_section): New function.
	(Output_section::set_is_large_section): New function.
	(Output_section::is_large_data_section): New function.
	(class Output_segment): Add is_large_data_segment_ field.
	(Output_segment::is_large_data_segment): New function.
	(Output_segment::set_is_large_data_segment): New function.
	* output.cc (Output_section::Output_section): Initialize new
	fields.
	(Output_segment::Output_segment): Likewise.
	(Output_segment::add_output_section): Add assertion that large
	data sections always go in large data segments.  Force small data
	sections to the end of the list of data sections.  Force small BSS
	sections to the start of the list of BSS sections.  For large BSS
	sections to the end of the list of BSS sections.
	* symtab.h (class Symbol): Declare is_common_shndx.
	(Symbol::is_defined): Check Symbol::is_common_shndx.
	(Symbol::is_common): Likewise.
	(class Symbol_table): Define enum Commons_section_type.  Update
	declarations.  Add small_commons_ and large_commons_ fields.
	* symtab.cc (Symbol::is_common_shndx): New function.
	(Symbol_table::Symbol_table): Initialize new fields.
	(Symbol_table::add_from_object): Put small and large common
	symbols in the right list.
	(Symbol_table::sized_finalized_symbol): Check
	Symbol::is_common_shndx.
	(Symbol_table::sized_write_globals): Likewise.
	* common.cc (Symbol_table::do_allocate_commons): Allocate new
	common symbol lists.  Don't call do_allocate_commons_list if the
	list is empty.
	(Symbol_table::do_allocate_commons_list): Remove is_tls
	parameter.  Add comons_section_type parameter.  Change all
	callers.  Handle small and large common symbols.
	* object.cc (Sized_relobj::do_finalize_local_symbols): Check
	Symbol::is_common_shndx.
	* resolve.cc (symbol_to_bits): Likewise.
	* target.h (Target::small_common_shndx): New function.
	(Target::small_common_section_flags): New function.
	(Target::large_common_shndx): New function.
	(Target::large_common_section_flags): New function.
	(Target::new_output_section): New function.
	(Target::Target_info): Add small_common_shndx, large_common_shndx,
	small_common_section_flags, and large_common_section_flags
	fields.
	(Target::do_new_output_section): New virtual function.
	* arm.cc (Target_arm::arm_info): Initialize new fields.
	* i386.cc (Target_i386::i386_info): Likewise.
	* powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
	Likewise.
	* sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
	* x86_64.cc (Target_x86_64::x86_64_info): Likewise.
	(Target_x86_64::do_new_output_section): New function.
	* configure.ac: Define conditional MCMODEL_MEDIUM.
	* testsuite/Makefile.am (check_PROGRAMS): Add large.
	(large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
	(large_LDFLAGS): Define.
	* testsuite/large.c: New file.
	* testsuite/testfile.cc (Target_test::test_target_info):
	Initialize new fields.
	* configure, testsuite/Makefile.in: Rebuild.
2009-06-22 06:51:53 +00:00
Doug Kwan 96d493066d 2009-06-03 Doug Kwan <dougkwan@google.com>
* arm.cc (utils::sign_extend): Reverse test in gold_assert.
	(utils::has_overflow): Same.
2009-06-04 01:31:01 +00:00
Doug Kwan c121c67179 2009-06-03 Doug Kwan <dougkwan@google.com>
* gold/arm.cc (namespace utils): New.
	(Target_arm::reloc_is_non_pic): Define new method.
	(class Arm_relocate_functions): New.
	(Target_arm::Relocate::relocate): Handle relocation types used by
	Android.
2009-06-03 19:33:05 +00:00
Ian Lance Taylor 07800fab6e * arm.cc (Target_arm::scan::global): Use || instead of |. 2009-06-03 14:05:07 +00:00
Doug Kwan bec53400ce 2009-06-02 Doug Kwan <dougkwan@google.com>
* gold/arm.cc (Target_arm::Scan::Scan):  Initialize
	issued_non_pic_error_.
	(class Target_arm::Scan): Declare new method check_non_pic.
	Define new method symbol_needs_plt_entry.
	Declare new data member issued_non_pic_error_.
	(class Target_arm::Relocate): Declare new method
	should_apply_static_reloc.
	(Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
	(Target_arm::Scan::check_non_pic): Define new method.
	(Target_arm::Scan::local): Handle a small subset of reloc types used
	by Android.
	(Target_arm::Scan::local): Same.
	(Target_arm::Relocate::should_apply_statci_reloc): Define new method.
2009-06-03 00:06:15 +00:00
Doug Kwan 94cdfcffc3 2009-05-29 Doug Kwan <dougkwan@google.com>
* gold/arm.cc (Output_data_plt_arm): Forward declaration for new
	template class.
	(class Target_arm): Update comment.
	(Target_arm::Target_arm): Initialize new data members GOT_,
	PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
	Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
	and Target_arm::rel_dyn_section.
	Declare new_enum Target_arm::Got_type.
	Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
	and DYNBSS_.
	Update commments for member do_dynsym_value.
	(Target_arm::got_size, Target_arm::plt_section,
	Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
	new methods inside class defintion.
	(Target_arm::got_section): Define new method.
	(Target_arm::rel_dyn_section): Same.
	(Output_data_plt_arm): New template class.
	(Output_data_plt_arm::Output_data_plt_arm): Define constructor.
	(Output_data_plt_arm:do_adjust_output_section): Define new method.
	(Output_data_plt_arm::add_entry): Same.
	(Output_data_plt_arm::first_plt_entry): Define new
	static data member for PLT instruction template.
	(Output_data_plt_arm::plt_entry): Same.
	(Output_data_plt_arm::do_write): Define new method.
	(Target_arm::make_plt_entry): Same.
	(Target_arm::do_finalize_sections): Same.
	(Target_arm::do_dynsym_value): Same.
2009-05-30 00:55:42 +00:00
Doug Kwan 4a657b0d92 2009-05-28 Doug Kwan <dougkwan@google.com>
* configure.ac: Support gold for target arm*-*-*.
        * configure: Regenerate.
        * gold/Makefile.am (TARGETSOURCES): Add arm.cc.
        (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
        * gold/Makefile.in: Regenerate.
        * gold/arm.cc: New file.
        * gold/configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
2009-05-29 00:15:12 +00:00