Commit Graph

206 Commits

Author SHA1 Message Date
Marcus Shawcroft cc0efaa802 [AArch64] Fix creation of .got and placement of _GLOBAL_OFFSET_TABLE_ 2013-07-02 06:39:26 +00:00
Marcus Shawcroft 8db339a667 [AArch64] Fix the placement of &_DYNAMIC in the GOT. 2013-06-27 15:47:55 +00:00
Yufeng Zhang caed712042 [AArch64, ILP32] 4/6 Split elfnn-aarch64.c to elfxx-aarch64.c
bfd/

	* Makefile.am (BFD64_BACKENDS): Add elfxx-aarch64.c.
	(BFD64_BACKENDS_CFILES): Add elfxx-aarch64.lo.
	* Makefile.in: Re-generated.
	* configure.in (bfd_elf64_bigaarch64_vec): Add elfxx-aarch64.lo.
	(bfd_elf64_littleaarch64_vec): Likewise.
	(bfd_elf32_bigaarch64_vec): Likewise.
	(bfd_elf32_littleaarch64_vec): Likewise.
	* configure: Re-generated.
	* elfxx-aarch64.c: New file; split from elf64-aarch64.c.
	* elfxx-aarch64.h: New file.
	* elfnn-aarch64.c: Include "elfxx-aarch64.h"; move the following
	stuff to elfxx-aarch64.c.
	(bfd_elf_aarch64_put_addend): Removed.
	(PG_OFFSET, PG): Likewise.
	(elfNN_aarch64_small_plt0_entry): Support ELF32.
	(elfNN_aarch64_tlsdesc_small_plt_entry): Likewise.
	(elf64_aarch64_grok_prstatus): Removed.
	(elf_backend_grok_prstatus): Removed.
	(insn32): Likewise.
	(aarch64_unsigned_overflow): Likewise.
	(aarch64_signed_overflow): Likewise.
	(aarch64_resolve_relocation): Likewise.
	(MASK): Likewise.
	(decode_branch_ofs_26): Likewise.
	(decode_cond_branch_ofs_19): Likewise.
	(decode_ld_lit_ofs_19): Likewise.
	(decode_tst_branch_ofs_14): Likewise.
	(decode_movw_imm): Likewise.
	(decode_adr_imm): Likewise.
	(decode_add_imm): Likewise.
	(reencode_branch_ofs_26): Likewise.
	(reencode_cond_branch_ofs_19): Likewise.
	(reencode_ld_lit_ofs_19): Likewise.
	(reencode_tst_branch_ofs_14): Likewise.
	(reencode_movw_imm): Likewise.
	(reencode_adr_imm): Likewise.
	(reencode_ldst_pos_imm): Likewise.
	(reencode_add_imm): Likewise.
	(reencode_movzn_to_movz): Likewise.
	(reencode_movzn_to_movn): Likewise.
	(aarch64_relocate): Update to call the new function names in
	elfxx-aarch64.c.
	(aarch64_calculate_got_entry_vma): Likewise.
	(elfNN_aarch64_final_link_relocate): Likewise.
	(elf64_aarch64_update_plt_entry): Likewise; change the type of the
	parameter 'r_type' to bfd_reloc_code_real_type; rename to ...
	(elf_aarch64_update_plt_entry): ... this.
	(elfNN_aarch64_create_small_pltn_entry): Update.
	(elfNN_aarch64_init_small_plt0_entry): Remove plt_got_base; add
	bfd_vma plt_got_2nd_ent; update to call elf_aarch64_update_plt_entry.
	(elfNN_aarch64_finish_dynamic_sections): Add plt_entry; update to
	call elf_aarch64_update_plt_entry.
2013-06-26 10:49:29 +00:00
Yufeng Zhang a6bb11b2df [AArch64, ILP32] 3/6 Support for ELF32 relocs and refactor reloc handling
bfd/

	* bfd-in2.h: Re-generated.
	* elfnn-aarch64.c (HOWTO64, HOWTO32): New define.
	(IS_AARCH64_TLS_RELOC): Change to be based on the
	bfd reloc enumerators.
	(IS_AARCH64_TLSDESC_RELOC): Likewise.
	(PG, PG_OFFSET): Cast literal to bfd_vma.
	(elf64_aarch64_howto_table): Removed.
	(elf64_aarch64_howto_dynrelocs): Removed.
	(elf64_aarch64_tls_howto_table): Removed.
	(elf64_aarch64_tlsdesc_howto_table): Removed.
	(elfNN_aarch64_howto_table): New table to host all howto entires..
	(R_AARCH64_*): Replaced by AARCH64_R (*) and AARCH64_R_STR (*).
	(elfNN_aarch64_bfd_reloc_from_howto): New function.
	(elfNN_aarch64_bfd_reloc_from_type): Ditto.
	(struct elf_aarch64_reloc_map): New.
	(elf_aarch64_reloc_map): New table.
	(elfNN_aarch64_howto_from_bfd_reloc): New function.
	(elfNN_aarch64_howto_from_type): Update to look up the new table
	elfNN_aarch64_howto_table.
	(struct elf64_aarch64_reloc_map): Remove.
	(elf64_aarch64_reloc_map): Remove.
	(elfNN_aarch64_reloc_type_lookup): Change to call
	elfNN_aarch64_howto_from_bfd_reloc.
	(elfNN_aarch64_reloc_name_lookup): Change to look up the new table
	elfNN_aarch64_howto_table.
	(aarch64_resolve_relocation): Refactor to switch on the bfd
	reloc enumerators.
	(bfd_elf_aarch64_put_addend): Likewise.
	(elfNN_aarch64_final_link_relocate): Likewise.
	(aarch64_tls_transition_without_check): Likewise.
	(aarch64_reloc_got_type): Likewise.
	(aarch64_can_relax_tls): Likewise.
	(aarch64_tls_transition): Likewise.
	(elfNN_aarch64_tls_relax): Likewise.
	(elfNN_aarch64_final_link_relocate): Likewise.
	(elfNN_aarch64_relocate_section): Likewise.
	(elfNN_aarch64_gc_sweep_hook): Likewise.
	(elfNN_aarch64_check_relocs): Likewise.
	(aarch64_tls_transition): Change to return a bfd reloc enumerator.
	* libbfd.h: Re-generated.
	* reloc.c: Re-order the AArch64 bfd reloc enumerators.
	(BFD_RELOC_AARCH64_RELOC_START)
	(BFD_RELOC_AARCH64_RELOC_END)
	(BFD_RELOC_AARCH64_LD_GOT_LO12_NC)
	(BFD_RELOC_AARCH64_LD32_GOT_LO12_NC)
	(BFD_RELOC_AARCH64_TLSDESC_LD_LO12_NC)
	(BFD_RELOC_AARCH64_TLSDESC_LD32_LO12_NC)
	(BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_LO12_NC)
	(BFD_RELOC_AARCH64_TLSIE_LD32_GOTTPREL_LO12_NC)
	(BFD_RELOC_AARCH64_IRELATIVE): New relocs.

gas/

	* config/tc-aarch64.c (reloc_table): Replace
	BFD_RELOC_AARCH64_LD64_GOT_LO12_NC with
	BFD_RELOC_AARCH64_LD_GOT_LO12_NC; likewise to
	BFD_RELOC_AARCH64_TLSDESC_LD64_LO12_NC and
	BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_LO12_NC.
	(md_apply_fix): Handle BFD_RELOC_AARCH64_LD_GOT_LO12_NC,
	BFD_RELOC_AARCH64_LD32_GOT_LO12_NC,
	BFD_RELOC_AARCH64_TLSDESC_LD_LO12_NC,
	BFD_RELOC_AARCH64_TLSDESC_LD32_LO12_NC,
	BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_LO12_NC and
	BFD_RELOC_AARCH64_TLSIE_LD32_GOTTPREL_LO12_NC.
	(aarch64_force_relocation): Likewise.

gas/testsuite/

	* gas/aarch64/ilp32-basic.d: New file.
	* gas/aarch64/ilp32-basic.s: New file.

include/elf/

	* aarch64.h: Add ELF32 reloc codes and remove fake ELF64 ones.
	(R_AARCH64_IRELATIVE): New reloc.
2013-06-26 10:47:06 +00:00
Yufeng Zhang cec5225bd8 [AArch64, ILP32] 2/6 Parametrize elfnn-aarch64.c and add basic support in ld
and gas.

bfd/

	* Makefile.am (BFD64_BACKENDS): Add elf32-aarch64.lo.
	(BUILD_CFILES): Add elf32-aarch64.c.
	(elf32-aarch64.c): New rule for generating from elfnn-aarch64.c.
	* Makefile.in: Re-generated.
	* archures.c (bfd_mach_aarch64_ilp32): New define.
	* bfd-in.h (bfd_elf32_aarch64_init_maps): New declaration.
	(bfd_elf32_aarch64_set_options): Ditto.
	(elf32_aarch64_setup_section_lists): Ditto.
	(elf32_aarch64_next_input_section): Ditto.
	(elf32_aarch64_size_stubs): Ditto.
	(elf32_aarch64_build_stubs): Ditto.
	* bfd-in2.h: Re-generated.
	* config.bfd (aarch64-*-elf): Add bfd_elf32_littleaarch64_vec
	and bfd_elf32_bigaarch64_vec.
	(aarch64-*-linux*): Likewise.
	(aarch64_be-*-elf): Likewise.
	(aarch64_be-*-linux*): Likewise.
	* configure.in (bfd_elf32_bigaarch64_vec)
	(bfd_elf32_littleaarch64_vec): New.
	* configure: Re-generated.
	* cpu-aarch64.c (compatible): Don't allow mixing ilp32 objects with
	lp64 ones.
	(bfd_aarch64_arch_ilp32): New.
	(bfd_aarch64_arch): Link to bfd_aarch64_arch_ilp32.
	* elfnn-aarch64.c (ARCH_SIZE): New define.
	(AARCH64_R, AARCH64_R_STR, LOG_FILE_ALIGN): New defines.
	(GOT_ENTRY_SIZE): Re-define as (ARCH_SIZE / 8).
	(elf64_aarch64_*): Rename to elfNN_aarch64_*.
	(ELF64_R_*): Rename to ELFNN_R_*.
	Plus other paramaterization.
	* targets.c (bfd_elf32_bigaarch64_vec, bfd_elf32_littleaarch64_vec):
	New declarations.
	(_bfd_target_vector): Add bfd_elf32_bigaarch64_vec and
	bfd_elf32_littleaarch64_vec.

gas/

	* config/tc-aarch64.c (ilp32_p): New static variable.
	(elf64_aarch64_target_format): Return the target according to the
	value of 'ilp32_p'.
	(md_begin): Determine 'mach' according to the value of 'ilp32_p'.
	(aarch64_opts): Add support for options '-milp32' and '-mlp64'.
	(aarch64_dwarf2_addr_size): New function.
	* config/tc-aarch64.h (aarch64_dwarf2_addr_size): New declaration.
	(DWARF2_ADDR_SIZE): New define.

ld/

	* Makefile.am (ALL_64_EMULATION_SOURCES): Add eaarch64elf32.c.
	(eaarch64elf32.c): New dependency and rule.
	* Makefile.in: Re-generated.
	* configure.tgt (aarch64-*-elf): Add aarch64elf32.
	(aarch64_be-*-elf, aarch64_be-*-linux*, aarch64-*-linux*): Likewise.
	* emulparams/aarch64elf32.sh: New file.
2013-06-26 10:41:42 +00:00
Yufeng Zhang 8119711413 [AArch64, ILP32] 1/6 Rename elf64-aarch64.c to elfnn-aarch64.c
bfd/

	* Makefile.am (BFD64_BACKENDS_CFILES): Remove elf64-aarch64.c.
	(BUILD_CFILES): Add elf64-aarch64.c.
	(elf64-aarch64.c): New rule for generating from elfnn-aarch64.c.
	* Makefile.in: Re-generated.
	* elf64-aarch64.c: Rename to ...
	* elfnn-aarch64.c: ... this.
2013-06-26 10:37:46 +00:00