summaryrefslogtreecommitdiff
path: root/bfd/elf32-arm.c
diff options
context:
space:
mode:
authorYufeng Zhang <yufeng.zhang@arm.com>2012-11-16 18:32:59 +0000
committerYufeng Zhang <yufeng.zhang@arm.com>2012-11-16 18:32:59 +0000
commit738d9287a8f03d58121d4c7c0a366420ef1f6f29 (patch)
treed74991a1d41a58468b35f8aaecebed84975ba7ee /bfd/elf32-arm.c
parent75852dbff5c314674c132b15b6db0206738046a8 (diff)
downloadbinutils-redhat-738d9287a8f03d58121d4c7c0a366420ef1f6f29.tar.gz
bfd/ChangeLog
2012-11-16 Joey Ye <joey.ye@arm.com> * elf32-arm.c (elf32_arm_final_link_relocate, case R_ARM_THM_ALU_PREL_11_0, case R_ARM_THM_PC12): Align address of the place being relocated. (elf32_arm_final_link_relocate, case R_ARM_THM_PC8): Align address of the place being relocated and truncate addend. (Pa): New macro.
Diffstat (limited to 'bfd/elf32-arm.c')
-rw-r--r--bfd/elf32-arm.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 081265c529..fd7d26a71b 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -63,6 +63,9 @@
#define ARM_ELF_ABI_VERSION 0
#define ARM_ELF_OS_ABI_VERSION ELFOSABI_ARM
+/* The Adjusted Place, as defined by AAELF. */
+#define Pa(X) ((X) & 0xfffffffc)
+
static bfd_boolean elf32_arm_write_section (bfd *output_bfd,
struct bfd_link_info *link_info,
asection *sec,
@@ -8619,9 +8622,9 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
}
relocation = value + signed_addend;
- relocation -= (input_section->output_section->vma
- + input_section->output_offset
- + rel->r_offset);
+ relocation -= Pa (input_section->output_section->vma
+ + input_section->output_offset
+ + rel->r_offset);
value = abs (relocation);
@@ -8651,12 +8654,12 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
insn = bfd_get_16 (input_bfd, hit_data);
if (globals->use_rel)
- addend = (insn & 0x00ff) << 2;
+ addend = ((((insn & 0x00ff) << 2) + 4) & 0x3ff) -4;
relocation = value + addend;
- relocation -= (input_section->output_section->vma
- + input_section->output_offset
- + rel->r_offset);
+ relocation -= Pa (input_section->output_section->vma
+ + input_section->output_offset
+ + rel->r_offset);
value = abs (relocation);
@@ -8691,9 +8694,9 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
}
relocation = value + signed_addend;
- relocation -= (input_section->output_section->vma
- + input_section->output_offset
- + rel->r_offset);
+ relocation -= Pa (input_section->output_section->vma
+ + input_section->output_offset
+ + rel->r_offset);
value = abs (relocation);