Commit Graph

215 Commits

Author SHA1 Message Date
Doug Kwan d8d2f43311 2009-07-27 Doug Kwan <dougkwan@google.com>
* elf32-arm.c (stub_hash_newfunc): Initialize field output_name.
2009-07-27 23:04:05 +00:00
Doug Kwan cedfb17907 2009-07-10 Doug Kwan <dougkwan@google.com>
* elf32-arm.c (stub_hash_newfunc): Initialize fields
	target_addend and orig_insn.
2009-07-10 16:56:15 +00:00
Julian Brown 33c6a8fcd6 * elf32-arm.c (arm_build_one_stub): Use the hash entry of the
symbol a stub entry is derived from, not the entry for the stub
	itself, in call to elf32_arm_final_link_relocate.
2009-07-10 14:57:00 +00:00
Nick Clifton e1ec24c6f3 PR 10072
* elf32-arm.c (elf32_arm_final_link_relocate): Add code to handle
        to R_ARM_THM_PC8 relocation.
2009-07-01 14:48:26 +00:00
Christophe Lyon 022f83127a 2009-06-22 Christophe Lyon <christophe.lyon@st.com>
bfd/
	* elf32-arm.c (elf32_arm_size_stubs): Use PLT address as
	destination for defined dynamic symbols when deciding whether to
	insert a stub or not.
	(allocate_dynrelocs): Make sure functions are not marked as Thumb
	when actually accessed through a PLT, even when generating a
	shared lib.

	ld/testsuite:
	* ld-arm/farcall-mixed-app.s: Add new references to check more
	modes switching.
	* ld-arm/farcall-mixed-lib1.s: Likewise.
	* ld-arm/farcall-mixed-app-v5.d: Update expected result.
	* farcall-mixed-app.d: Likewise.
	* ld-arm/farcall-mixed-lib.d: Likewise.
2009-06-22 10:55:33 +00:00
Alan Modra 87d72d41b0 * elf-bfd.h (struct sym_sec_cache): Delete.
(struct sym_cache): New.
	(bfd_section_from_r_symndx): Delete prototype.
	(bfd_sym_from_r_symndx): Define prototype.
	* elf.c (bfd_section_from_r_symndx): Delete, replace with..
	(bfd_sym_from_r_symndx): ..new function.
	* elf32-arm.c: Update all uses of struct sym_sec_cache and
	bfd_section_from_r_symndx to new struct and function.
	* elf32-bfin.c: Likewise.
	* elf32-hppa.c: Likewise.
	* elf32-i386.c: Likewise.
	* elf32-m32r.c: Likewise.
	* elf32-m68hc1x.c: Likewise.
	* elf32-m68hc1x.h: Likewise.
	* elf32-m68k.c: Likewise.
	* elf32-ppc.c: Likewise.
	* elf32-s390.c: Likewise.
	* elf32-sh.c: Likewise.
	* elf64-ppc.c: Likewise.
	* elf64-s390.c: Likewise.
	* elf64-x86-64.c: Likewise.
	* elfxx-sparc.c: Likewise.
	* elfxx-sparc.h: Likewise.
2009-06-18 14:18:29 +00:00
H.J. Lu 64e77c6d5f 2009-06-17 H.J. Lu <hongjiu.lu@intel.com>
* elf32-arm.c (create_got_section): Get existing .rela.got
	section.
	* elf32-hppa.c (elf32_hppa_create_dynamic_sections): Likewise.
	* elf32-lm32.c (create_got_section): Likewise.
	* elf32-m32r.c (create_got_section): Likewise.
	* elf32-ppc.c (ppc_elf_create_got): Likewise.
	* elf32-s390.c (create_got_section): Likewise.
	* elf32-sh.c (create_got_section): Likewise.
	* elf32-xtensa.c (elf_xtensa_create_dynamic_sections): Likewise.
	* elf64-s390.c (create_got_section): Likewise.
	* elfxx-sparc.c (create_got_section): Likewise.

	* elflink.c (_bfd_elf_create_got_section): Properly initialize
	the GOT size.
2009-06-17 18:08:35 +00:00
Phil Blundell 4116d8d7c5 Undo accidental checkin of bogus change 2009-06-17 15:46:18 +00:00
Nick Clifton 81694485e2 * elf32-arm.c (cortex_a8_erratum_scan): Change type of offset
to bfd_signed_vma.  Cast constant operands which are used in
   offset related expressions to bfd_signed_vma type as appropriate.
2009-06-16 11:33:42 +00:00
Phil Blundell dec9d5dfd7 2009-06-10 Philip Blundell <philb@gnu.org>
* elf32-arm.c (elf32_arm_fix_exidx_coverage): Avoid crash if
	elf_sec->this_hdr == NULL.
2009-06-12 14:26:08 +00:00
Julian Brown 48229727d8 ld/
* emultempl/armelf.em (fix_cortex_a8): New.
    (arm_elf_before_allocation): Call bfd_elf32_arm_set_cortex_a8_fix.
    (arm_elf_create_output_section_statements): Add fix_cortex_a8 to
    bfd_elf32_arm_set_target_relocs.
    (OPTION_FIX_CORTEX_A8, OPTION_NO_FIX_CORTEX_A8): New.
    (PARSE_AND_LIST_LONGOPTS): Add [no-]fix-cortex-a8 options.
    (PARSE_AND_LIST_OPTIONS): Add [no-]fix-cortex-a8 options.
    (PARSE_AND_LIST_ARGS_CASES): Handle OPTION_[NO_]FIX_CORTEX_A8.
    * ld.texinfo (--[no-]fix-cortex-a8): Briefly document new options.

    bfd/
    * elf32-arm.c (THUMB16_BCOND_INSN, THUMB32_INSN, THUMB32_B_INSN):
    New macros.
    (elf32_arm_stub_a8_veneer_b_cond, elf32_arm_stub_a8_veneer_b)
    (elf32_arm_stub_a8_veneer_blx): New stub sequences.
    (elf32_arm_stub_type): Add arm_stub_a8_veneer_b_cond,
    arm_stub_a8_veneer_b and arm_stub_a8_veneer_blx.
    (elf32_arm_stub_hash_entry): Add target_addend, orig_insn fields.
    (a8_erratum_fix, a8_erratum_reloc): New structs.
    (elf32_arm_link_hash_table): Add a8_erratum_fixes,
    num_a8_erratum_fixes, fix_cortex_a8 fields.
    (elf32_arm_link_hash_table_create): Zero fix_cortex_a8.
    (elf32_arm_add_stub): Split into two parts, creating...
    (elf32_arm_create_or_find_stub_sec): New function.
    (elf32_arm_final_link_relocate): Add forward declaration.
    (arm_build_one_stub): Add support for THUMB32_TYPE, Thumb-2
    relocations, multiple relocations per stub.
    (find_stub_size_and_template): New (using parts of
    arm_size_one_stub).
    (arm_size_one_stub): Use find_stub_size_and_template.
    (a8_reloc_compare): New.
    (find_thumb_glue): Add forward declaration.
    (cortex_a8_erratum_scan): New.
    (elf32_arm_size_stubs): Add Cortex-A8 erratum workaround support.
    (bfd_elf32_arm_set_cortex_a8_fix): New.
    (bfd_elf32_arm_set_target_relocs): Add fix_cortex_a8 argument.
    (arm_map_one_stub): Add THUMB32_TYPE support.
    (a8_branch_to_stub_data): New.
    (make_branch_to_a8_stub): New.
    (elf32_arm_write_section): Add Cortex-A8 erratum workaround support.
    * bfd-in.h (bfd_elf32_arm_set_cortex_a8_fix): New.
    (bfd_elf32_arm_set_target_relocs): Add argument for controlling
    Cortex-A8 erratum workaround.
    * bfd-in2.h: Regenerate.

    ld/testsuite/
    * ld-arm/cortex-a8-arm-target.s: New.
    * ld-arm/cortex-a8-thumb-target.s: New.
    * ld-arm/cortex-a8-fix-b-rel.s: New.
    * ld-arm/cortex-a8-fix-b-rel-arm.d: New.
    * ld-arm/cortex-a8-fix-b-rel-thumb.d: New.
    * ld-arm/cortex-a8-fix-b.s: New.
    * ld-arm/cortex-a8-fix-b.d: New.
    * ld-arm/cortex-a8-fix-bl-rel.s: New.
    * ld-arm/cortex-a8-fix-bl-rel-arm.d: New.
    * ld-arm/cortex-a8-fix-bl-rel-thumb.d: New.
    * ld-arm/cortex-a8-fix-bl.s: New.
    * ld-arm/cortex-a8-fix-bl.d: New.
    * ld-arm/cortex-a8-fix-bcc-rel.s: New.
    * ld-arm/cortex-a8-fix-bcc-rel-thumb.d: New.
    * ld-arm/cortex-a8-fix-bcc.s: New.
    * ld-arm/cortex-a8-fix-bcc.d: New.
    * ld-arm/cortex-a8-fix-blx-rel.s: New.
    * ld-arm/cortex-a8-fix-blx-rel-arm.d: New.
    * ld-arm/cortex-a8-fix-blx-rel-thumb.d: New.
    * ld-arm/cortex-a8-fix-blx.s: New.
    * ld-arm/cortex-a8-fix-blx.d: New.
    * ld-arm/arm-elf.exp: Add new tests.
2009-05-22 11:58:45 +00:00
Alan Modra 6e0b88f1b8 * elf-bfd.h (struct elf_backend_data
<elf_backend_link_output_symbol_hook>): Return an int.
	* elf64-ppc.c (ppc64_elf_output_symbol_hook): Return 2 to drop
	symbols on deleted .opd entries.
	* elflink.c (elf_link_output_sym): Return without outputting sym
	if output_symbol_hook returns 2.
	(elf_link_output_extsym): Don't assign h->indx when symbol discarded.
	Abort if we must not discard sym.
	(elf_link_input_bfd): Similarly, don't set finfo->indices for
	local syms.
	(bfd_elf_final_link): Adjust elf_link_output_sym calls.
	* elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Adjust for
	elf_backend_link_output_symbol_hook return type change.
	* elf32-arm.c (output_arch_syminfo): Likewise.
	(elf32_arm_output_map_sym, elf32_arm_output_stub_sym): Likewise.
	(elf32_arm_output_arch_local_syms): Likewise.
	* elf32-cr16c.c (elf32_cr16c_link_output_symbol_hook): Likewise.
	* elf32-score.c (s3_bfd_score_elf_link_output_symbol_hook): Likewise.
	(bfd_score_elf_link_output_symbol_hook): Likewise.
	* elf32-score.h (s7_bfd_score_elf_link_output_symbol_hook): Likewise.
	* elf32-score7.c (s7_bfd_score_elf_link_output_symbol_hook): Likewise.
	* elf32-sh64.c (sh64_elf_link_output_symbol_hook): Likewise.
	* elf32-spu.c (spu_elf_output_symbol_hook): Likewise.
	* elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise.
	* elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise.
	* elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise.
	* elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise.
	* elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise.
	* elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise.
	* elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise.
2009-05-21 14:15:50 +00:00
Paul Brook 22a8f80ef5 2009-05-15 Andrew Stubbs <ams@codesourcery.com>
Paul Brook  <paul@codesourcery.com>

	bfd/
	* elf32-arm.c (elf32_arm_fix_exidx_coverage): Don't attempt to
	fix discarded sections.

	ld/testsuite/
	* ld-arm/arm-elf.exp: Add unwind-5.
	* ld-arm/discard-unwind.ld: New file.
	* ld-arm/unwind-5.d: New test.
	* ld-arm/unwind-5.s: New test.
2009-05-15 00:08:12 +00:00
Andrew Jenner 6e6718a332 * elf32-arm.c: Move sysdep.h to start of file. 2009-05-13 16:46:42 +00:00
Paul Brook 2468f9c95d 2009-05-05 Paul Brook <paul@codesourcery.com>
bfd/
	* bfd-in.h (elf32_arm_fix_exidx_coverage): Add prototype.
	* bfd-in2.h: Regenerate.
	* elf32-arm.c (arm_unwind_edit_type, arm_unwind_table_edit): Define.
	(_arm_elf_section_data): Add text and exidx fields.
	(add_unwind_table_edit, get_arm_elf_section_data, adjust_exidx_size,
	insert_cantunwind_after, elf32_arm_fix_exidx_coverage, offset_prel31,
	copy_exidx_entry): New functions.
	(elf32_arm_write_section): Fixup .ARM.exidx contents.

	ld/
	* emultempl/armelf.em (compare_output_sec_vma): New function.
	(gld${EMULATION_NAME}_finish): Add exidx munging code.

	ld/testsuite/
	* ld-arm/arm.ld: Add .ARM.exidx and .ARM.extab.
	* ld-arm/arm-elf.exp: Add unwind-[1-4].
	* ld-arm/unwind-1.d: New test.
	* ld-arm/unwind-1.s: New test.
	* ld-arm/unwind-2.d: New test.
	* ld-arm/unwind-2.s: New test.
	* ld-arm/unwind-3.d: New test.
	* ld-arm/unwind-3.s: New test.
	* ld-arm/unwind-4.d: New test.
	* ld-arm/unwind-4.s: New test.
2009-05-05 14:18:30 +00:00
Christophe Lyon 738a79f669 2009-05-05 Christophe lyon <christophe.lyon@st.com>
bfd/
	* elf32-arm.c (DEF_STUBS): New helper define.
	(DEF_STUB): Likewise.
	(stub_def): New type.
	(stub_definitions): New array, containing stub template pointers
	and sizes.
	(arm_size_one_stub): Make use of stub_definitions.
2009-05-05 13:16:56 +00:00
Joseph Myers 96c23d5966 bfd:
* elf32-arm.c (elf32_arm_check_relocs): Give errors for absolute
	MOVW and MOVT relocations in a shared library link.

ld/testsuite:
	* ld-arm/movw-shared-1.d, ld-arm/movw-shared-1.s,
	ld-arm/movw-shared-2.d, ld-arm/movw-shared-2.s,
	ld-arm/movw-shared-3.d, ld-arm/movw-shared-3.s,
	ld-arm/movw-shared-4.d, ld-arm/movw-shared-4.s: New tests.
	* ld-arm/arm-elf.exp: Run these new tests.
2009-04-30 00:01:11 +00:00
Christophe Lyon 155d87d738 2009-04-22 Christophe Lyon <christophe.lyon@st.com>
PR9743
	bfd/
	* elf32-arm.c (arm_type_of_stub): Handle R_ARM_THM_JUMP24,
	R_ARM_JUMP24 and R_ARM_PLT32 relocations.
	(elf32_arm_size_stubs): Likewise.
	(record_thumb_to_arm_glue): Deleted unused function.
	(bfd_elf32_arm_process_before_allocation): No longer handle
	R_ARM_THM_JUMP24, R_ARM_JUMP24 and R_ARM_PLT32 relocations here.
	(elf32_arm_final_link_relocate): Handle R_ARM_THM_JUMP24,
	R_ARM_JUMP24 and R_ARM_PLT32 relocations.

	testsuite/
	* ld-arm/arm-call.d: Update expected result.
	* ld-arm/arm-pic-veneer.d: Likewise.
	* ld-arm/thumb2-b-interwork.d: Likewise.
2009-04-22 14:01:31 +00:00
Daniel Jacobowitz 3e6b10420e bfd/
* elf32-arm.c (INTERWORK_FLAG): Check BFD_LINKER_CREATED.
	(elf32_arm_write_section): Declare early.
	(elf32_arm_size_stubs): Skip non-stub sections in the stub BFD.
	(arm_allocate_glue_section_space): Exclude empty sections.
	(ARM_GLUE_SECTION_FLAGS): Add SEC_LINKER_CREATED.
	(bfd_elf32_arm_add_glue_sections_to_bfd): Do not skip the stub
	BFD.
	(elf32_arm_output_glue_section, elf32_arm_final_link): New.
	(elf32_arm_merge_eabi_attributes): Skip the stub BFD.
	(elf32_arm_size_dynamic_sections): Allocate interworking
	sections here.
	(bfd_elf32_bfd_final_link): Define.

	ld/
	* emultempl/armelf.em (bfd_for_interwork, arm_elf_after_open)
	(arm_elf_set_bfd_for_interworking): Delete.
	(arm_elf_before_allocation): Do not set the interworking BFD.
	Move allocation inside not-dynamic block.
	(arm_elf_create_output_section_statements): Create glue sections
	and set the interworking BFD here.
	(LDEMUL_AFTER_OPEN): Delete.

	ld/testsuite/
	* ld-arm/farcall-mix.d, ld-arm/farcall-mix2.d,
	ld-arm/farcall-group-size2.d, ld-arm/farcall-group.d,
	ld-arm/farcall-mixed-lib.d: Update for linker changes.
2009-04-21 22:05:04 +00:00
Christophe Lyon 69c5861ee1 2009-04-17 Christophe Lyon <christophe.lyon@st.com>
bfd/
	* elf32-arm.c (elf32_arm_size_stubs): Handle long branches through
	PLT entries to an undefined symbol when generating a shared
	library.

	testsuite/
	* ld-arm/arm-elf.exp: Add new test farcall-mixed-lib.
	* ld-arm/farcall-mixed-lib.d: Update expected output.
	* ld-arm/farcall-mixed-lib1.s: New file.
	* ld-arm/farcall-mixed-lib2.s: New file.
2009-04-17 13:04:41 +00:00
Christophe Lyon 82b5c97a79 2009-04-15 Christophe Lyon <christophe.lyon@st.com>
bfd/
	* elf32-arm.c (elf32_arm_final_link_relocate): Don't convert ARM
	branch to an undef weak symbol into a jump to next instruction if
	a PLT entry will be created.

	testsuite/
	* ld-arm/arm-elf.exp: Add 1 more test to check undef weak
	reference with PLT in ARM mode.
	* ld-arm/thumb2-bl-undefweak1.d, ld-arm/thumb2-bl-undefweak1.s:
	New files.
2009-04-15 13:49:54 +00:00
Christophe Lyon d3626fb08b 2009-04-02 Christophe Lyon <christophe.lyon@st.com>
bfd/
	* elf32-arm.c (elf32_arm_stub_long_branch_v4t_thumb_thumb,
	elf32_arm_stub_long_branch_v4t_thumb_thumb_pic): Two new long
	branch stubs.
	(elf32_arm_stub_type): New enum values for the two new stubs.
	(arm_type_of_stub): Make use of the two new stubs.
	(arm_size_one_stub): Handle the two new stubs.

	testsuite/
	* ld-arm/farcall-thumb-thumb-pic-veneer.d: Update expected
	results.
	* ld-arm/farcall-thumb-thumb.d: Likewise.
2009-04-02 14:12:46 +00:00
Christophe Lyon e780aef286 2009-04-01 Christophe Lyon <christophe.lyon@st.com>
bfd/
	* elf32-arm.c (group_sections): Rewrite loops for better
	readability.
2009-04-01 15:34:12 +00:00
Mark Mitchell 3895f85287 * coff-arm.c (coff_arm_merge_private_bfd_data): Use "error:", not
"ERROR:", in error messages.
	* cpu-arm.c (bfd_arm_merge_machines): Likewise.
	* elf-attrs.c (_bfd_elf_merge_object_attributes): Likewise.
	* elf32-arm.c (tag_cpu_arch_combine): Likewise.
	(elf32_arm_merge_eabi_attributes): Likewise.
	(elf32_arm_merge_private_bfd_data): Likewise.
2009-03-28 23:19:00 +00:00
Daniel Jacobowitz a89e647837 * elf32-arm.c (elf32_arm_check_relocs): Correct symbian_p test. 2009-03-17 14:50:48 +00:00
Nick Clifton ce98a316e9 PR 9934
* elf-bfd.h (NUM_SHDR_ENTRIES): Cope with an empty section.
        * elflink.c (elf_link_read_relocs_from_section): Use
        NUM_SHDR_ENTRIES.  Gracefully handle the case where there are
        relocs but no symbol table.
        * elf32-arm.c (elf32_arm_check_relocs): Likewise.
2009-03-13 11:34:43 +00:00
Christophe Lyon 8cd931b713 09-03-05 Christophe Lyon <christophe.lyon@st.com>
bfd/
	* elf32-arm.c (group_sections): Take next section size into
	account before accepting to group it.

	testsuite/
	* ld-arm/arm-elf.exp: Add new farcall-group-limit test.
	* ld-arm/farcall-group-limit.d: New file.
	* ld-arm/farcall-group3.s: New file.
	* ld-arm/farcall-group4.s: New file.
2009-03-06 08:57:58 +00:00
Christophe Lyon 5fa9e92f74 2009-03-05 Christophe Lyon <christophe.lyon@st.com>
bfd/
	* elf32-arm.c (arm_type_of_stub): Handle long branches targetting
	PLT entries.
	(elf32_arm_final_link_relocate): Likewise.

	testsuite/
	* ld-arm/arm-elf.exp: Add 2 more tests to check long branch stubs
	in PLT context.
	* ld-arm/farcall-mixed-app-v5.d: New file.
	* ld-arm/farcall-mixed-app.d: Likewise.
	* ld-arm/farcall-mixed-app.r: Likewise.
	* ld-arm/farcall-mixed-app.s: Likewise.
	* ld-arm/farcall-mixed-app.sym: Likewise.
	* ld-arm/farcall-mixed-lib.d: Likewise.
	* ld-arm/farcall-mixed-lib.r: Likewise.
2009-03-05 17:28:21 +00:00
Christophe Lyon ebe24dd4f8 2009-02-26 Christophe Lyon <christophe.lyon@st.com>
bfd/
	* elf32-arm.c (stub_reloc_type): Removed.
	(insn_sequence): Renamed reloc_type field to r_type.
	(elf32_arm_stub_long_branch_v4t_arm_thumb_pic): New stub.
	(elf32_arm_stub_long_branch_v4t_thumb_arm_pic): Likewise.
	(elf32_arm_stub_long_branch_thumb_only_pic): Likewise.
	(elf32_arm_stub_type): Add new enum entries for the new stubs.
	(arm_stub_is_thumb): Catch new stubs.
	(arm_type_of_stub): Handle new stubs.
	(arm_size_one_stub): Use ARRAY_SIZE. Handle new stubs.
	(bfd_elf32_arm_process_before_allocation): Remove useless
	condition.

	testsuite/
	* ld-arm/arm-elf.exp: Add 3 tests for the 3 new stubs.
	* ld-arm/farcall-thumb-arm-pic-veneer.d: New expected result, the
	test is now expected to pass.
	* ld-arm/farcall-thumb-thumb-m-pic-veneer.d: Likewise.
	* ld-arm/farcall-thumb-thumb-pic-veneer.d: Likewise.
2009-02-26 15:37:53 +00:00
Daniel Jacobowitz cf3eccff18 bfd/
* elf32-arm.c (elf32_arm_stub_long_branch_any_any_pic): Rename
	to elf32_arm_stub_long_branch_any_arm_pic.
	(elf32_arm_stub_long_branch_any_thumb_pic): New.
	(enum elf32_arm_stub_type, arm_type_of_stub)
	(arm_size_one_stub): Handle any to ARM PIC and any to Thumb PIC
	separately.

	ld/testsuite/
	* ld-arm/farcall-arm-thumb-blx-pic-veneer.d,
	ld-arm/farcall-arm-thumb-pic-veneer.d,
	ld-arm/farcall-thumb-thumb-blx-pic-veneer.d: Update for fixed
	Thumb PIC stub.
2009-02-24 22:44:18 +00:00
Daniel Jacobowitz 07d72278cd 2009-02-24 Joseph Myers <joseph@codesourcery.com>
bfd/
	* elf32-arm.c (PREV_SEC): Update comment.
	(group_sections): Rename argument to stubs_always_after_branch.
	Reverse the list and place stubs at the end of input sections.
	Undefine NEXT_SEC.
	(elf32_arm_size_stubs): Update to use stubs_always_after_branch.

	ld/
	* ld.texinfo (ARM): Document changed meaning of --stub-group-size.
	* emultempl/armelf.em (hook_in_stub): Insert after the input section.
	(elf32_arm_add_stub_section): Update comment.
	(PARSE_AND_LIST_OPTIONS): Update help for --stub-group-size.

2009-02-24  Daniel Jacobowitz  <dan@codesourcery.com>

	ld/testsuite/
	* ld-arm/arm-elf.exp (armeabitests): Update duplicate test names.
	Use normal output files for big-endian.
	* ld-arm/farcall-arm-arm-be.d, ld-arm/farcall-thumb-arm-be.d: Delete.
	* ld-arm/farcall-arm-arm-be8.d, ld-arm/farcall-arm-arm-pic-veneer.d,
	ld-arm/farcall-arm-arm.d, ld-arm/farcall-arm-thumb-blx-pic-veneer.d,
	ld-arm/farcall-arm-thumb-blx.d, ld-arm/farcall-arm-thumb-pic-veneer.d,
	ld-arm/farcall-arm-thumb.d, ld-arm/farcall-group-size2.d,
	ld-arm/farcall-group.d, ld-arm/farcall-mix.d, ld-arm/farcall-mix2.d,
	ld-arm/farcall-thumb-arm-be8.d,
	ld-arm/farcall-thumb-arm-blx-pic-veneer.d,
	ld-arm/farcall-thumb-arm-blx.d, ld-arm/farcall-thumb-arm-short.d,
	ld-arm/farcall-thumb-arm.d,
	ld-arm/farcall-thumb-thumb-blx-pic-veneer.d,
	ld-arm/farcall-thumb-thumb-blx.d, ld-arm/farcall-thumb-thumb-m.d,
	ld-arm/farcall-thumb-thumb.d, ld-arm/thumb2-bl-as-thumb1-bad.d,
	ld-arm/thumb2-bl-bad.d: Update for moved stubs.
2009-02-24 22:43:10 +00:00
Daniel Jacobowitz 4e31c73195 * elf32-arm.c (arm_build_one_stub): Initialize stub_reloc_offset.
Fix formatting.
	(arm_size_one_stub): Remove unnecessary break.
	(arm_map_one_stub): Fix formatting.  Return after BFD_FAIL.
2009-02-24 00:26:40 +00:00
Daniel Jacobowitz 461a49caca 2009-02-23 Christophe Lyon <christophe.lyon@st.com>
bfd/
	* elf32-arm.c (stub_insn_type): New type.
	(stub_reloc_type): Likewise.
	(insn_sequence): Likewise.
	(elf32_arm_stub_long_branch_any_any): Encode using insn_sequence.
	(elf32_arm_stub_long_branch_v4t_arm_thumb): Likewise.
	(elf32_arm_stub_long_branch_thumb_only): Likewise.
	(elf32_arm_stub_long_branch_v4t_thumb_arm): Likewise.
	(elf32_arm_stub_short_branch_v4t_thumb_arm): Likewise.
	(elf32_arm_stub_long_branch_any_any_pic): Likewise.
	(elf32_arm_stub_hash_entry): Add new helper fields.
	(stub_hash_newfunc): Initialize these new fields.
	(arm_build_one_stub): Encode Arm and Thumb instructions separately
	to take endianness into account.
	(arm_size_one_stub): Compute size of stubs using insn_sequence.
	(arm_map_one_stub): Code is now more generic, thanks to
	insn_sequence.

	ld/testsuite/
	* ld-arm/arm-elf.exp: Add new farcall-thumb-arm-be8 test.
	* ld-arm/farcall-thumb-arm-be8.d: New expected result.
	* ld-arm/farcall-arm-arm-be8.d: Replace wildcards by instructions.
2009-02-23 21:48:53 +00:00
Christophe Lyon c2b4a39dd2 2009-02-23 Christophe Lyon <christophe.lyon@st.com>
bfd/
	* elf32-arm.c (elf32_arm_stub_long_branch_thumb_only): Fix stub
	code.
	(elf32_arm_stub_long_branch_v4t_thumb_arm): Likewise.
	(arm_type_of_stub): Use Thumb-only long branch stub (non-PIC) when
	BLX is not available. Fix typo in warning message. Add comments
	and improve formatting.
	(arm_build_one_stub): Adjust to new
	elf32_arm_stub_long_branch_v4t_thumb_arm stub.
	(arm_map_one_stub): Likewise.

	testsuite/
	* ld-arm/arm-elf.exp: Rewrite non-EABI variants of
	thumb2-bl-as-thumb1-bad and thumb2-bl-bad tests, which now
	pass. farcall-thumb-thumb now passes in EABI mode.
	* ld-arm/farcall-thumb-arm-pic-veneer.d: Fixed name, source, as
	and ld flags to match intended test.
	* ld-arm/farcall-thumb-arm.d: New expected result.
	* ld-arm/farcall-thumb-thumb-m.d: Likewise.
	* ld-arm/farcall-thumb-thumb-m-pic-veneer.d: Fixed name and ld
	flags.
	* ld-arm/farcall-thumb-thumb-pic-veneer.d: Likewise.
	* ld-arm/farcall-thumb-thumb.d: New expected result, this test is
	now expected to pass.
	* ld-arm/thumb2-bl-as-thumb1-bad-noeabi.d: Likewise.
	* ld-arm/thumb2-bl-bad-noeabi.d: Likewise.
	* ld-arm/thumb2-bl-as-thumb1-bad.d: Update addresses according to
	new use.
	* ld-arm/thumb2-bl-as-thumb1-bad.s: Update comment.
2009-02-23 10:03:47 +00:00
Christophe Lyon 90d8a22ca2 2009-02-18 Christophe Lyon <christophe.lyon@st.com>
bfd/
	* elf32-arm.c (arm_build_one_stub): Fix relocation target for pic
	stub. Catch default case error.
	(arm_map_one_stub): Add missing Thumb mapping symbol.

	testsuite/
	* ld-arm/farcall-arm-arm-pic-veneer.d,
	ld-arm/farcall-arm-thumb-blx-pic-veneer.d,
	ld-arm/farcall-arm-thumb-pic-veneer.d,
	ld-arm/farcall-thumb-arm-blx-pic-veneer.d,
	ld-arm/farcall-thumb-thumb-blx-pic-veneer.d: Fix expected stub
	target.
2009-02-18 16:56:37 +00:00
Christophe Lyon fea2b4d6bd 2009-02-16 Christophe Lyon <christophe.lyon@st.com>
bfd/
	* elf32-arm.c (arm_long_branch_stub,
	arm_thumb_v4t_long_branch_stub,
	arm_thumb_thumb_long_branch_stub,
	arm_thumb_arm_v4t_long_branch_stub,
	arm_thumb_arm_v4t_short_branch_stub,
	arm_pic_long_branch_stub):
	Renamed to elf32_arm_stub_long_branch_any_any,
	elf32_arm_stub_long_branch_v4t_arm_thumb,
	elf32_arm_stub_long_branch_thumb_only,
	elf32_arm_stub_long_branch_v4t_thumb_arm,
	elf32_arm_stub_short_branch_v4t_thumb_arm,
	elf32_arm_stub_long_branch_any_any_pic.
	(arm_stub_long_branch, arm_thumb_v4t_stub_long_branch,
	arm_thumb_thumb_stub_long_branch,
	arm_thumb_arm_v4t_stub_long_branch,
	arm_thumb_arm_v4t_stub_short_branch, arm_stub_pic_long_branch):
	Renamed to arm_stub_long_branch_any_any,
	arm_stub_long_branch_v4t_arm_thumb,
	arm_stub_long_branch_thumb_only,
	arm_stub_long_branch_v4t_thumb_arm,
	arm_stub_short_branch_v4t_thumb_arm,
	arm_stub_long_branch_any_any_pic.
2009-02-18 12:45:38 +00:00
Joseph Myers 33a7ffc270 2009-01-30 Julian Brown <julian@codesourcery.com>
* elf32-arm.c (bfd_elf32_arm_vfp11_erratum_scan): Skip BFDs with
	EXEC_P or DYNAMIC flags, and skip sections which are being linked
	with --just-symbols (-R).
2009-01-30 01:32:25 +00:00
Catherine Moore 528aeb629f * elf32-arm.c (elf32_arm_check_relocs): Set SEC_ALLOC and
SEC_LOAD for dynamic relocation sections.
2009-01-28 16:35:13 +00:00
Andrew Stubbs 5aa6ff7ca4 2009-01-19 Andrew Stubbs <ams@codesourcery.com>
bfd/
	* elf-attrs.c (vendor_set_obj_attr_contents): Support tag ordering.
	* elf-bfd.h (elf_backend_data): Add obj_attrs_order.
	* elf32-arm.c (elf32_arm_obj_attrs_order): New function.
	(elf_backend_obj_attrs_order): New define.
	* elfxx-target.h (elf_backend_obj_attrs_order): New define.
	(elfNN_bed): Add elf_backend_obj_attrs_order.

	gas/testsuite/
	* gas/arm/attr-order.d: New file.
	* gas/arm/attr-order.s: New file.
2009-01-19 12:14:05 +00:00
Andrew Stubbs 3483fe2e0b 2009-01-19 Andrew Stubbs <ams@codesourcery.com>
bfd/
	* elf-attrs.c (is_default_attr): Substitute magic numbers with macros.
	(obj_attr_size): Likewise.
	(write_obj_attribute): Likewise.
	(_bfd_elf_copy_obj_attributes): Likewise.
	(_bfd_elf_parse_attributes): Likewise.
	* elf-bfd.h (ATTR_TYPE_FLAG_INT_VAL): New define.
	(ATTR_TYPE_FLAG_STR_VAL, ATTR_TYPE_FLAG_NO_DEFAULT): New defines.
	(ATTR_TYPE_HAS_INT_VAL, ATTR_TYPE_HAS_STR_VAL): New defines.
	(ATTR_TYPE_HAS_NO_DEFAULT): New define.
	* elf32-arm.c (elf32_arm_obj_attrs_arg_type): Replace magic numbers
	with macros.
2009-01-19 11:55:35 +00:00
Andrew Stubbs 2d0bb7614b 2009-01-19 Andrew Stubbs <ams@codesourcery.com>
bfd/
	* elf-attrs.c (is_default_attr): Support defaultless attributes.
	(bfd_elf_add_obj_attr_int): Get type from _bfd_elf_obj_attrs_arg_type.
	(bfd_elf_add_obj_attr_string): Likewise.
	(bfd_elf_add_obj_attr_int_string): Likewise.
	(_bfd_elf_parse_attributes): Allow for unknown flag bits in type.
	* elf-bfd.h (struct obj_attribute): Document new flag bit.
	* elf32-arm.c (elf32_arm_obj_attrs_arg_type): Specify that
	Tag_nodefaults has no default value.
	(elf32_arm_merge_eabi_attributes): Modify the Tag_nodefaults
	comment to reflect the new state.

	gas/
	* read.c (s_vendor_attribute): Allow for unknown flag bits in type.
2009-01-19 11:50:31 +00:00
Andrew Stubbs 91e22acdfa 2009-01-15 Andrew Stubbs <ams@codesourcery.com>
Julian Brown   <julian@codesourcery.com>

	bfd/
	* elf-bfd.h (NUM_KNOWN_OBJ_ATTRIBUTES): Set to 71 to include all known
	ARM attributes in ABI 2.07.
	* elf32-arm.c (get_secondary_compatible_arch): New function.
	(set_secondary_compatible_arch): New function.
	(tag_cpu_arch_combine): New function.
	(elf32_arm_copy_one_eabi_other_attribute): Delete function.
	(elf32_arm_copy_eabi_other_attribute_list): Delete function.
	(elf32_arm_merge_eabi_attributes): Rename order_312 to order_021 to
	make it fit with order_01243.
	Add support for Tag_also_compatible_with,
	Tag_CPU_unaligned_access, Tag_T2EE_use, Tag_Virtualization_use,
	Tag_MPextension_use, Tag_nodefaults and Tag_conformance.
	Improve/tidy up support for Tag_CPU_raw_name, Tag_CPU_name,
	Tag_CPU_arch, Tag_ABI_HardFP_use, Tag_VFP_HP_extension,
	Tag_ABI_FP_denormal, Tag_ABI_PCS_GOT_use, Tag_ABI_align8_needed,
	Tag_VFP_arch and Tag_ABI_FP_16bit_format.
	Rework the way unknown attributes are handled.
	Defer errors until all attributes have been processed.

	gas/
	* config/tc-arm.c (cpu_arch): Change ARM_ARCH_V6M to 11.

	include/elf/
	* arm.h (TAG_CPU_ARCH_V6_M, TAG_CPU_ARCH_V6S_M): New defines.
	(MAX_TAG_CPU_ARCH, TAG_CPU_ARCH_V4T_PLUS_V6_M): New defines.
	(Tag_NEON_arch): Rename to Tag_Advanced_SIMD_arch to match ARM ABI
	version 2.07.
	(Tag_undefined39, Tag_nodefaults): New enum values.
	(Tag_also_compatible_with, Tag_T2EE_use): Likewise.
	(Tag_conformance, Tag_Virtualization_use): Likewise.
	(Tag_undefined69, Tag_MPextension_use): Likewise.
2009-01-15 18:00:49 +00:00
Andrew Stubbs 7b86a9faa6 2009-01-15 Andrew Stubbs <ams@codesourcery.com>
bfd/
	* elf-attrs.c (bfd_elf_add_obj_attr_compat): Rename to
	bfd_elf_add_obj_attr_int_string.
	Read Tag_compatibility from its new location in the attribute array,
	rather than the attribute list.
	(_bfd_elf_copy_obj_attributes): bfd_elf_add_obj_attr_compat ->
	bfd_elf_add_obj_attr_int_string.
	(_bfd_elf_parse_attributes): Likewise.
	(_bfd_elf_merge_object_attributes): There's now only one
	Tag_compatibility, and it's in the array, not the list.
	* elf-bfd.h (NUM_KNOWN_OBJ_ATTRIBUTES): Set to 33 to include
	Tag_compatibility.
	(bfd_elf_add_obj_attr_compat): Rename to
	bfd_elf_add_obj_attr_int_string.
	(bfd_elf_add_proc_attr_compat): Rename to
	bfd_elf_add_proc_attr_int_string.
	* elf32-arm.c (elf32_arm_merge_eabi_attributes): Explicitly don't handle
	Tag_compatibility.

	gas/
	* read.c (s_vendor_attribute): bfd_elf_add_obj_attr_compat ->
	bfd_elf_add_obj_attr_int_string.
2009-01-15 13:03:05 +00:00
Nick Clifton af1f44191e PR 7093
* elf32-arm.c (bfd_elf32_arm_init_maps): Only process ARM ELF
        object files.
2008-12-23 11:46:17 +00:00
Nick Clifton 0f88be7a13 Remove STT_IFUNC support. 2008-12-23 09:01:51 +00:00
Nick Clifton e7c3341679 include/elf/
* common.h (STT_IFUNC): Define.
elfcpp/
            * elfcpp.h (enum STT): Add STT_IFUNC.
bfd/
            * syms.c (struct bfd_symbol): Add new flag BSF_INDIRECT_FUNCTION.
            Remove redundant flag BFD_FORT_COMM_DEFAULT_VALUE.  Renumber flags
            to remove gaps.
            (bfd_print_symbol_vandf): Return 'i' for BSF_INDIRECT_FUNCTION.
            (bfd_decode_symclass): Likewise.
            * elf.c (swap_out_syms): Translate BSF_INDIRECT_FUNCTION into
            STT_IFUNC.
            (elf_find_function): Treat STT_IFUNC in the same way as STT_FUNC.
            (_bfd_elf_is_function_type): Likewise.
            * elf32-arm.c (arm_elf_find_function): Likewise.
            (elf32_arm_adjust_dynamic_symbol): Likewise.
            (elf32_arm_swap_symbol_in): Likewise.
            (elf32_arm_additional_program_headers): Likewise.
            * elf32-i386.c (is_indirect_symbol): New function.
            (elf_i386_check_relocs): Also generate dynamic relocs for
            relocations against STT_IFUNC symbols.
            (allocate_dynrelocs): Likewise.
            (elf_i386_relocate_section): Likewise.
            * elf64-x86-64.c (is_indirect_symbol): New function.
            (elf64_x86_64_check_relocs): Also generate dynamic relocs for
            relocations against STT_IFUNC symbols.
            (allocate_dynrelocs): Likewise.
            (elf64_x86_64_relocate_section): Likewise.
            * elfcode.h (elf_slurp_symbol_table): Translate STT_IFUNC into
            BSF_INDIRECT_FUNCTION.
            * elflink.c (_bfd_elf_adjust_dynamic_reloc_section): Add support
            for STT_IFUNC symbols.
            (get_ifunc_reloc_section_name): New function.
            (_bfd_elf_make_ifunc_reloc_section): New function.
            * elf-bfd.h (struct bfd_elf_section_data): Add indirect_relocs field.
            * bfd-in2.h: Regenerate.
gas/
            * config/obj-elf.c (obj_elf_type): Add support for STT_IFUNC type.
            * doc/as.texinfo: Document new feature.
            * NEWS: Mention new feature.
gas/testsuite/
            * gas/elf/type.s: Add test of STT_IFUNC symbol type.
            * gas/elf/type.e: Update expected disassembly.
            * gas/elf/elf.exp: Update grep of symbol types.
ld/
            * NEWS: Mention new feature.
            * pe-dll.c (process_def_file): Replace use of redundant
            BFD_FORT_COMM_DEFAULT_VALUE with 0.
            * scripttempl/elf.sc: Add .rel.ifunc.dyn and .rela.ifunc.dyn
            sections.
ld/testsuite/
            * ld-mips-elf/reloc-1-n32.d: Updated expected output for reloc
            descriptions.
            * ld-mips-elf/reloc-1-n64.d: Likewise.
            * ld-i386/ifunc.d: New test.
            * ld-i386/ifunc.s: Source file for the new test.
            * ld-i386/i386.exp: Run the new test.
2008-12-03 14:51:00 +00:00
Joseph Myers 1954000798 bfd:
* elf32-arm.c (elf32_arm_final_link_relocate): Do not turn
	branches to undefine weak symbols into branches to the next
	instruction if creating PLT entries for those symbols.

ld/testsuite:
	* ld-arm/thumb2-bl-undefweak.d, ld-arm/thumb2-bl-undefweak.s: New.
	* ld-arm/arm-elf.exp: Run thumb2-bl-undefweak test.
2008-11-25 15:53:27 +00:00
Nick Clifton 83bac4b010 * elflink.c (is_reloc_section): New function. Returns true if the
given name matches the name of the reloc-containing section
        associated with the given section.
        (get_dynamic_reloc_section_name): New function.  Computes the name
        of the section that contains the dynamic relocs associated with
        the given section.
        (_bfd_elf_get_dynamic_reloc_section): New function.  Returns a
        pointer to the section containing the dynamic relocs associated
        with the given section.
        (_bfd_elf_make_dynamic_reloc_section): New function.  Creates a
        section to contain the dynamic relocs associated with a given
        section.
        * elf-bfd.h: Prototype the new functions.
        * elf-m10300.c (mn10300_elf_check_relocs): Use new functions.
        (mn10300_elf_final_link_relocs): Likewise.
        * elf32-arm.c (reloc_section_p): Delete - replaced by new
        functions.
        (elf32_arm_final_link_relocate): Use new functions.
        (elf32_arm_check_relocs): Likewise.
        * elf32-cris.c (cris_elf_relocate_section): Likewise.
        (elf_cris_check_relocs): Likewise.
        * elf32-hppa.c (elf32_hppa_check_relocs): Likewise.
        * elf32-i370.c (i370_elf_check_relocs): Likewise.
        (i370_elf_relocate_section): Likewise.
        * elf32-i386.c (elf_i386_check_relocs): Likewise.
        * elf32-m32r.c (m32r_elf_relocate_section): Likewise.
        (m32r_elf_check_relocs): Likewise.
        * elf32-m68k.c (elf_m68k_check_relocs): Likewise.
        * elf32_ppc.c (ppc_elf_check_relocs): Likewise.
        (ppc_elf_relocate_section): Likewise.
        * elf32-s390.c (elf_s390_check_relocs): Likewise.
        * elf32-sh.c (sh_elf_relocate_section): Likewise.
        (sh_elf_check_relocs): Likewise.
        * elf32-vax.c (elf_vax_check_relocs): Likewise.
        (elf_vax_relocate_section): Likewise.
        * elf64-alpha.c (elf64_alpha_check_relocs): Likewise.
        * elf64-ppc.c (ppc64_elf_check_relocs): Likewise.
        * elf64-s390.c (elf_s390_check_relocs): Likewise.
        * elf64-sh64.c (sh_elf64_relocate_section): Likewise.
        * elf64-x86-64.c (elf64_x86_64_check_relocs): Likewise.
        * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise.
        * elf32-bfin.c (bfin_check_relocs): Remove redundant local
        variable 'sreloc'.
        (bfin_relocate_section): Likewise.
        * elf32-v850.c (v850_elf_check_relocs): Likewise.
2008-11-25 13:03:56 +00:00
Catherine Moore 8e79c3df51 Add support for ARM half-precision conversion instructions. 2008-11-18 15:45:05 +00:00
Nick Clifton fcef9eb7bc * elf32-arm.c: Fix up comment describing Thumb to ARM interworking
stub.
2008-08-26 14:40:18 +00:00