diff options
author | Julian Brown <julian@codesourcery.com> | 2005-01-28 17:24:41 +0000 |
---|---|---|
committer | Julian Brown <julian@codesourcery.com> | 2005-01-28 17:24:41 +0000 |
commit | 319850b45155323419e8862ee9e1b20d12b3a62d (patch) | |
tree | 71d81d25b3464a0cfb07087d2a86a66d307c3931 /bfd | |
parent | c84141d67e109faa68267eba2fbfbb4840a103c2 (diff) | |
download | gdb-319850b45155323419e8862ee9e1b20d12b3a62d.zip gdb-319850b45155323419e8862ee9e1b20d12b3a62d.tar.gz gdb-319850b45155323419e8862ee9e1b20d12b3a62d.tar.bz2 |
* bfd/bin-in.h (bfd_elf32_arm_set_target_relocs): Update prototype.
* bfd/bin-in2.h (bfd_elf32_arm_set_target_relocs): Update prototype.
* bfd/elf32-arm.c (elf32_arm_link_hash_table): Add fix_v4bx flag.
(bfd_elf32_arm_set_target_relocs): Add formal parameter fix_v4bx for
passing flag value from ld. Set flag value in global hash table entry.
(elf32_arm_final_link_relocate): Add code to implement R_ARM_V4BX
relocation.
* ld/emultempl/armelf.em (fix_v4bx): New variable.
(arm_elf_create_output_section_statements): Communicate fix_v4bx flag
value to bfd.
(PARSE_AND_LIST_PROLOGUE): Add option token OPTION_FIX_V4BX.
(PARSE_AND_LIST_LONGOPTS): Add option --fix-v4bx.
(PARSE_AND_LIST_OPTIONS): Add option --fix-v4bx.
(PARSE_AND_LIST_ARGS_CASES): Add option OPTION_FIX_V4BX.
* ld/NEWS: Mention --fix-v4bx.
* ld/ld.texinfo: Document --fix-v4bx.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 10 | ||||
-rw-r--r-- | bfd/bfd-in.h | 2 | ||||
-rw-r--r-- | bfd/bfd-in2.h | 2 | ||||
-rw-r--r-- | bfd/elf32-arm.c | 23 |
4 files changed, 34 insertions, 3 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index a8f8a33..3b9a9b6 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,13 @@ +2005-01-28 Julian Brown <julian@codesourcery.com> + + * bin-in.h (bfd_elf32_arm_set_target_relocs): Update prototype. + * bin-in2.h (bfd_elf32_arm_set_target_relocs): Update prototype. + * elf32-arm.c (elf32_arm_link_hash_table): Add fix_v4bx flag. + (bfd_elf32_arm_set_target_relocs): Add formal parameter fix_v4bx for + passing flag value from ld. Set flag value in global hash table entry. + (elf32_arm_final_link_relocate): Add code to implement R_ARM_V4BX + relocation. + 2005-01-27 Andrew Cagney <cagney@gnu.org> * configure: Regenerate to track ../gettext.m4 change. diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index ff84516..1ca1450 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -817,7 +817,7 @@ extern bfd_boolean bfd_elf32_arm_process_before_allocation (bfd *, struct bfd_link_info *, int); void bfd_elf32_arm_set_target_relocs - (struct bfd_link_info *, int, char *); + (struct bfd_link_info *, int, char *, int); extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking (bfd *, struct bfd_link_info *); diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 6c783a0..da2d8cc 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -824,7 +824,7 @@ extern bfd_boolean bfd_elf32_arm_process_before_allocation (bfd *, struct bfd_link_info *, int); void bfd_elf32_arm_set_target_relocs - (struct bfd_link_info *, int, char *); + (struct bfd_link_info *, int, char *, int); extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking (bfd *, struct bfd_link_info *); diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 09b47d3..14f46f4 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -1165,6 +1165,9 @@ struct elf32_arm_link_hash_table /* The relocation to use for R_ARM_TARGET2 relocations. */ int target2_reloc; + /* Nonzero to fix BX instructions for ARMv4 targets. */ + int fix_v4bx; + /* The number of bytes in the initial entry in the PLT. */ bfd_size_type plt_header_size; @@ -1931,7 +1934,8 @@ error_return: void bfd_elf32_arm_set_target_relocs (struct bfd_link_info *link_info, int target1_is_rel, - char * target2_type) + char * target2_type, + int fix_v4bx) { struct elf32_arm_link_hash_table *globals; @@ -1949,6 +1953,7 @@ bfd_elf32_arm_set_target_relocs (struct bfd_link_info *link_info, _bfd_error_handler (_("Invalid TARGET2 relocation type '%s'."), target2_type); } + globals->fix_v4bx = fix_v4bx; } #endif @@ -2985,6 +2990,22 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, case R_ARM_RBASE: return bfd_reloc_notsupported; + case R_ARM_V4BX: + if (globals->fix_v4bx) + { + bfd_vma insn = bfd_get_32 (input_bfd, hit_data); + + /* Ensure that we have a BX instruction. */ + BFD_ASSERT ((insn & 0x0ffffff0) == 0x012fff10); + + /* Preserve Rm (lowest four bits) and the condition code + (highest four bits). Other bits encode MOV PC,Rm. */ + insn = (insn & 0xf000000f) | 0x01a0f000; + + bfd_put_32 (input_bfd, insn, hit_data); + } + return bfd_reloc_ok; + default: return bfd_reloc_notsupported; } |