Commit Graph

33 Commits

Author SHA1 Message Date
Doug Kwan d204b6e935 2009-11-15 Doug Kwan <dougkwan@google.com>
* arm.cc (Target_arm::may_use_arm_nop): New method definition.
	(Arm_relocate_functions::arm_branch_common): Change method defintion
	in class definition to a method declaration and update list of formal
	parameters.
	(Arm_relocate_functions::plt32, Arm_relocate_functions::call,
	Arm_relocation_functions::jump24): Adjust call to
	Arm_relocate_functions::arm_branch_common.  Update list of formal
	parameters.
	(Arm_relocate_functions::xpc25): New method definition.
	(Arm_relocate_functions::arm_branch_common): Move method defintion
	out from class definition.  Use stubs for mode-switching and extending
	branch ranges.
	(Target_arm::Relocate::relocate): Handle weakly-undefined symbols
	specially.  Change code to enable use of stubs in ARM branches.
2009-11-16 03:39:11 +00:00
Doug Kwan 43d12afeb9 2009-11-10 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
	in method declaration.
	(Target_arm::relocate_stub): New method declaration.
	(Target_arm::default_target): Change to return a pointer instead of
	a const reference.
	(Reloc_stub::stub_type_for_reloc): Adjust for the change in
	Target_arm::default_target.
	(Arm_Relobj::do_relocate_sections): Remove options paramater in
	method definition.
	(Target_arm::relocate_section): Adjust view.
	(Target_arm::relocate_stub): New method definition.
2009-11-09 23:16:55 +00:00
Doug Kwan 2daedcd627 2009-11-09 Doug Kwan <dougkwan@google.com>
* arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
	(arm_symbol_value): Remove.
	(Arm_relocate_functions::arm_branch_common,
	Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
	Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
	Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
	Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
	Arm_relocate_functions::call, Arm_relocate_functions::jump24,
	Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
	Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
	Arm_relocate_functions::thm_mobw_abs_nc,
	Arm_relocate_functions::thm_mov_abs,
	Arm_relocate_functions::movw_prel_nc,
	Arm_relocate_functions::thm_movt_abs,
	Arm_relocate_functions::movt_prel,
	Arm_relocate_functions::thm_movw_prel_nc,
	Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
	(Target_arm::Relocate::relocate): Only decompose address into two
	parts if relocation type uses the thumb-bit and pass the actual
	bit instead of a flag indicating that the thumb-bit is used.  Adjust
	calls to methods in Arm_relocate_functions for this change.
2009-11-09 16:03:45 +00:00
Doug Kwan eb44217c8b 2009-11-06 Doug Kwan <dougkwan@google.com>
* arm.cc (class Reloc_stub): Correct a comment.
	(Target_arm::Target_arm): Initialize arm_input_section_map_.
	(Target_arm::scan_section_for_stubs): New method declaration.
	(Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
	Change methods from private to protected.
	(Target_arm::do_may_relax): New method definition.
	(Target_arm::do_relax, Target_arm::group_sections,
	Target_arm::scan_reloc_for_stub,
	Target_arm::scan_reloc_section_for_stubs): New method declarations.
	(Target_arm::arm_input_section_map_): New data member declaration.
	(Target_arm::scan_reloc_for_stub,
	Target_arm::scan_reloc_section_for_stubs,
	Target_arm::scan_section_for_stubs, Target_arm::group_sections,
	Target_arm::do_relax): New method definitions.
2009-11-07 01:58:06 +00:00
Ian Lance Taylor 22b127cceb PR 10887
* arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
	tags if data is discarded by linker script.
	* i386.cc (Target_i386::do_finalize_sections): Likewise.
	* powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
	* sparc.cc (Target_sparc::do_finalize_sections): Likewise.
	* x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2009-11-04 16:35:51 +00:00
Ian Lance Taylor f5c870d25d * layout.cc (Layout::get_output_section): Add is_interp and
is_dynamic_linker_section parameters.  Change all callers.
	(Layout::choose_output_section): Likewise.
	(Layout::make_output_section): Likewise.
	(Layout::add_output_section_data): Add is_dynamic_linker_section
	parameter.  Change all callers.
	* layout.h (class Layout): Update declarations.
	* output.h (class Output_section): Add is_interp, set_is_interp,
	is_dynamic_linker_section, set_is_dynamic_linker_section methods.
	Add is_interp_, is_dynamic_linker_section_ fields.  Change
	generate_code_fills_at_write_ to a bitfield.
	* output.cc (Output_section::Output_sections): Initialize new
	fields.
	(Output_segment::add_output_section): Add do_sort parameter.
	Change all callers.
2009-11-04 15:56:03 +00:00
Doug Kwan 55da957988 2009-11-03 Doug Kwan <dougkwan@google.com>
* arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
	stub_factory_.
	(Target_arm::stub_factory): New method definition.
	(Target_arm::new_arm_input_section,
	Target_arm::find_arm_input_section, Target_arm::new_stub_table,
	Target_arm::reloc_uses_thumb_bit): New method declarations.
	(Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
	New type definitions.
	(Target_arm::stub_tables_, Target_arm::stub_factory_): New data
	member declarations.
	(Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
	Target_arm::find_arm_input_section, Target_arm::new_stub_table):
	New method definitions.
2009-11-03 21:18:13 +00:00
Doug Kwan ebd95253ac 2009-10-30 Doug Kwan <dougkwan@google.com>
* arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
2009-10-31 03:06:59 +00:00
Doug Kwan e9bbb53879 2009-10-30 Doug Kwan <dougkwan@google.com>
* arm.cc (Stub_addend_reader): New struct template definition
	and partial specializations.
	(Stub_addend_reader::operator()): New method definition for a
	partially specialized template.
2009-10-31 02:59:36 +00:00
Doug Kwan d5b40221bc 2009-10-30 Doug Kwan <dougkwan@google.com>
elfcpp/ChangeLog:
	* arm.h (EF_ARM_BE8, EF_ARM_EABIMASK, EF_ARM_EABI_UNKNOWN,
	EF_ARM_EABI_VER1, EF_ARM_EABI_VER2, EF_ARM_EABI_VER3,
	EF_ARM_EABI_VER4, EF_ARM_EABI_VER5): New enums for processor-specific
	flags.
	(arm_eabi_version): New inline function.
	* elfcpp.h: Add a comment about DT_ENCODING.

gold/ChangeLog:
	* arm.cc (Arm_relobj::processor_specific_flags): New method
	definition.
	(Arm_relobj::do_read_symbols): New method declaration.
	(Arm_relobj::processor_specific_flags_): New data member declaration.
	(Arm_dynobj): New class definition.
	(Target_arm::do_finalize_sections): Add input_objects parameter.
	(Target_arm::do_adjust_elf_header): New method declaration.
	(Target_arm::are_eabi_versions_compatible,
	(Target_arm::merge_processor_specific_flags): New method declaration.
	(Target_arm::do_make_elf_object): New overloaded method definitions
	and declaration.
	(Arm_relobj::do_read_symbols): New method definition.
	(Arm_dynobj::do_read_symbols): Ditto.
	(Target_arm::do_finalize_sections): Add input_objects parameters.
	Merge processor-specific flags from all input objects.
	(Target_arm::are_eabi_versions_compatible,
	Target_arm::merge_processor_specific_flags,
	Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
	New method definitions.
	* i386.cc (Target_i386::do_finalize_sections): Add unnamed
	Input_objects pointer type parameter.
	* layout.cc (Layout::finalize): Pass input objects to target's.
	finalize_sections function.
	* output.cc (Output_file_header::do_sized_write): Set ELF file
	header's processor-specific flags.
	* powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
	Input_objects pointer type parameter.
	* sparc.cc (Target_sparc::do_finalize_sections): Same.
	* target.h (Input_objects): New forward class declaration.
	(Target::processor_specific_flags,
	Target::are_processor_specific_flags_sect): New method definitions.
	(Target::finalize_sections): Add input_objects parameter.
	(Target::Target): Initialize processor_specific_flags_ and
	are_processor_specific_flags_set_.
	(Target::do_finalize_sections): Add unnamed Input_objects pointer type
	parameter.
	(Target::set_processor_specific_flags): New method definition.
	(Target::processor_specific_flags_,
	Target::are_processor_specific_flags_set_): New data member
	declarations.
	* x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
	Input_objects pointer type parameter.
2009-10-30 18:49:59 +00:00
Doug Kwan ebabffbd89 2009-10-30 Doug Kwan <dougkwan@google.com>
* arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
2009-10-30 18:00:55 +00:00
Ian Lance Taylor ad0f2072a6 * object.h (class Relobj): Drop options parameter from
gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
	do_scan_relocs, do_relocate.  Change all callers.
	(class Sized_relobj): Drop options parameters from
	do_gc_process_relocs, do_scan_relocs, do_relocate,
	do_relocate_sections, relocate_sections, emit_relocs_scan,
	emit_relocs_scan_reltype.  Change all callers.
	(struct Relocate_info): Remove options field and all references to
	it.
	* reloc.h (class Read_relocs): Remove options constructor
	parameter and options_ field.  Change all callers.
	(class Gc_process_relocs, class Scan_relocs): Likewise.
	(class Relocate_task): Likewise.
	* target-reloc.h (scan_relocs): Remove options parameter.  Change
	all callers.
	(scan_relocatable_relocs): Likewise.
	* target.h (class Sized_target): Remove options parameter from
	gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
	all callers.
	* gc.h (gc_process_relocs): Remove options parameter.  Change all
	callers.
	* arm.cc: Update functions to remove options parameters.
	* i386.cc: Likewise.
	* powerpc.cc: Likewise.
	* sparc.cc: Likewise.
	* x86_64.cc: Likewise.
	* testsuite/testfile.cc: Likewise.
2009-10-29 05:16:23 +00:00
Doug Kwan 8ffa366761 2009-10-28 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_relobj): New class definition.
	(Arm_relobj::scan_sections_for_stubs,
	Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
	New method definitions.
2009-10-29 01:53:35 +00:00
Doug Kwan 07f508a253 2009-10-24 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
	(Arm_input_section::as_arm_input_section): New method.
	(Arm_output_section): New class definition.
	(Arm_output_section::create_stub_group,
	Arm_output_section::group_sections): New method definitions.
2009-10-24 09:36:15 +00:00
Doug Kwan 10ad9fe591 2009-10-22 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_input_section): New class definition.
	(Arm_input_section::init, Arm_input_section:do_write,
	Arm_input_section::set_final_data_size,
	Arm_input_section::do_reset_address_and_file_offset): New method
	definitions.
2009-10-22 18:58:02 +00:00
Doug Kwan 56ee5e00a8 2009-10-21 Doug Kwan <dougkwan@google.com>
* arm.cc (Stub_table, Arm_input_section): New forward class
	declarations.
	(Stub_table): New class defintion.
	(Stub_table::add_reloc_stub, Stub_table::relocate_stubs
	Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
	New method definition.
2009-10-21 18:33:18 +00:00
Doug Kwan b569affa94 2009-10-21 Doug Kwan <dougkwan@google.com>
* arm.cc: Update copyright comments.
	(Target_arm): New forward class template declaration.
	(Arm_address): New type.
	(ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
	THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
	THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
	constants.
	(Insn_template): Same.
	(DEF_STUBS): New macro.
	(Stub_type): New enum type.
	(Stub_template): New class definition.
	(Stub): Same.
	(Reloc_stub): Same.
	(Stub_factory): Same.
	(Target_arm::Target_arm): Initialize may_use_blx_ and
	should_force_pic_veneer_.
	(Target_arm::may_use_blx, Target_arm::set_may_use_blx,
	Target_arm::should_force_pic_veneer,
	Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
	Target_arm::using_thumb_only, Target_arm:;default_target): New
	method defintions.
	(Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
	New data member declarations.
	(Insn_template::size, Insn_template::alignment): New method defintions.
	(Stub_template::Stub_template): New method definition.
	(Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
	Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
	(Stub_factory::Stub_factory): New method definition.
	* gold.h (string_hash): New template.
	* output.h (Input_section_specifier::hash_value): Use
	gold::string_hash.
	(Input_section_specifier::string_hash): Remove.
	* stringpool.cc (Stringpool_template::string_hash): Use
	gold::string_hash.
2009-10-21 08:08:41 +00:00
Sriraman Tallam f345227a0c * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
includes to gc.h and icf.h.
	* arm.cc: Include gc.h.
	* gold.cc: Likewise.
	* i386.cc: Likewise.
	* powerpc.cc: Likewise.
	* sparc.cc: Likewise.
	* x86_64.cc: Likewise.
	* gc.h: Include icf.h.
2009-10-13 00:39:31 +00:00
Ian Lance Taylor be8fcb7563 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
	R_ARM_BASE_ABS.
	(Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
	(Arm_relocate_functions::thm_abs5): New function.
	(Arm_relocate_functions::abs12): New function.
	(Arm_relocate_functions::abs16): New function.
	(Arm_relocate_functions::base_abs): New function.
	(Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
	(Scan::local): Remove special handling of R_ARM_ABS8.  Handle
	R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
	R_ARM_BASE_ABS.
	(Scan::global): Likewise.
	(Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
	R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
	(Relocatable_size_for_reloc::get_size_for_reloc): Handle
	R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
	R_ARM_BASE_ABS.
2009-10-09 22:56:41 +00:00
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