GNU Binutils with patches for OS216
Revisión | 84a86c64e04791b62dc41da99dfe17ae97176652 (tree) |
---|---|
Tiempo | 2012-11-17 03:44:06 |
Autor | Yufeng Zhang <yufeng.zhang@arm....> |
Commiter | Yufeng Zhang |
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.
@@ -1,3 +1,12 @@ | ||
1 | +2012-11-16 Joey Ye <joey.ye@arm.com> | |
2 | + | |
3 | + * elf32-arm.c (elf32_arm_final_link_relocate, | |
4 | + case R_ARM_THM_ALU_PREL_11_0, case R_ARM_THM_PC12): Align address of | |
5 | + the place being relocated. | |
6 | + (elf32_arm_final_link_relocate, case R_ARM_THM_PC8): Align address | |
7 | + of the place being relocated and truncate addend. | |
8 | + (Pa): New macro. | |
9 | + | |
1 | 10 | 2012-05-11 Ralf Corsépius <ralf.corsepius@rtems.org> |
2 | 11 | |
3 | 12 | Backport from mainline: |
@@ -1,6 +1,6 @@ | ||
1 | 1 | /* 32-bit ELF support for ARM |
2 | 2 | Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, |
3 | - 2008, 2009, 2010, 2011 Free Software Foundation, Inc. | |
3 | + 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. | |
4 | 4 | |
5 | 5 | This file is part of BFD, the Binary File Descriptor library. |
6 | 6 |
@@ -61,6 +61,9 @@ | ||
61 | 61 | #define ARM_ELF_ABI_VERSION 0 |
62 | 62 | #define ARM_ELF_OS_ABI_VERSION ELFOSABI_ARM |
63 | 63 | |
64 | +/* The Adjusted Place, as defined by AAELF. */ | |
65 | +#define Pa(X) ((X) & 0xfffffffc) | |
66 | + | |
64 | 67 | static bfd_boolean elf32_arm_write_section (bfd *output_bfd, |
65 | 68 | struct bfd_link_info *link_info, |
66 | 69 | asection *sec, |
@@ -8441,9 +8444,9 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, | ||
8441 | 8444 | } |
8442 | 8445 | |
8443 | 8446 | relocation = value + signed_addend; |
8444 | - relocation -= (input_section->output_section->vma | |
8445 | - + input_section->output_offset | |
8446 | - + rel->r_offset); | |
8447 | + relocation -= Pa (input_section->output_section->vma | |
8448 | + + input_section->output_offset | |
8449 | + + rel->r_offset); | |
8447 | 8450 | |
8448 | 8451 | value = abs (relocation); |
8449 | 8452 |
@@ -8473,12 +8476,12 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, | ||
8473 | 8476 | insn = bfd_get_16 (input_bfd, hit_data); |
8474 | 8477 | |
8475 | 8478 | if (globals->use_rel) |
8476 | - addend = (insn & 0x00ff) << 2; | |
8479 | + addend = ((((insn & 0x00ff) << 2) + 4) & 0x3ff) -4; | |
8477 | 8480 | |
8478 | 8481 | relocation = value + addend; |
8479 | - relocation -= (input_section->output_section->vma | |
8480 | - + input_section->output_offset | |
8481 | - + rel->r_offset); | |
8482 | + relocation -= Pa (input_section->output_section->vma | |
8483 | + + input_section->output_offset | |
8484 | + + rel->r_offset); | |
8482 | 8485 | |
8483 | 8486 | value = abs (relocation); |
8484 | 8487 |
@@ -8513,9 +8516,9 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, | ||
8513 | 8516 | } |
8514 | 8517 | |
8515 | 8518 | relocation = value + signed_addend; |
8516 | - relocation -= (input_section->output_section->vma | |
8517 | - + input_section->output_offset | |
8518 | - + rel->r_offset); | |
8519 | + relocation -= Pa (input_section->output_section->vma | |
8520 | + + input_section->output_offset | |
8521 | + + rel->r_offset); | |
8519 | 8522 | |
8520 | 8523 | value = abs (relocation); |
8521 | 8524 |