summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYufeng Zhang <yufeng.zhang@arm.com>2012-11-16 18:54:06 +0000
committerYufeng Zhang <yufeng.zhang@arm.com>2012-11-16 18:54:06 +0000
commit748726a90259707a12b5b8a36e30f755e3c204ab (patch)
treef693173110f7f65aead28e1f38e0ebeec0e32d2f
parentbf8946de165b344711e16345768bb1ef3f1fdbce (diff)
downloadbinutils-redhat-binutils-2_21-branch.tar.gz
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.
-rw-r--r--bfd/ChangeLog9
-rw-r--r--bfd/elf32-arm.c25
2 files changed, 23 insertions, 11 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 6bcef2fd71..301847084b 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,12 @@
+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.
+
2011-06-27 Tristan Gingold <gingold@adacore.com>
* Makefile.am (RELEASE): Unset.
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index e03ce0e0a7..c94f5146a9 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -1,6 +1,6 @@
/* 32-bit ELF support for ARM
Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
- 2008, 2009, 2010 Free Software Foundation, Inc.
+ 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -61,6 +61,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,
@@ -7390,9 +7393,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);
@@ -7422,12 +7425,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);
@@ -7462,9 +7465,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);