mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-21 18:39:34 +08:00
(arm_add_to_rel): Fix R_ARM_THM_PC22 relocations.
This commit is contained in:
@ -1,3 +1,8 @@
|
||||
2000-09-29 Momchil Velikov <velco@fadata.bg>
|
||||
|
||||
* elf32-arm.h (arm_add_to_rel): Correctly adjust the addend for
|
||||
R_ARM_THM_PC22 relocations.
|
||||
|
||||
2000-09-29 NIIBE Yutaka <gniibe@chroot.org>
|
||||
|
||||
* elflink.h (elf_link_add_object_symbols): Don't bfd_release runpath.
|
||||
|
@ -1642,9 +1642,32 @@ arm_add_to_rel (abfd, address, howto, increment)
|
||||
reloc_howto_type * howto;
|
||||
bfd_signed_vma increment;
|
||||
{
|
||||
bfd_vma contents;
|
||||
bfd_signed_vma addend;
|
||||
|
||||
if (howto->type == R_ARM_THM_PC22)
|
||||
{
|
||||
int upper_insn, lower_insn;
|
||||
int upper, lower;
|
||||
|
||||
upper_insn = bfd_get_16 (abfd, address);
|
||||
lower_insn = bfd_get_16 (abfd, address + 2);
|
||||
upper = upper_insn & 0x7ff;
|
||||
lower = lower_insn & 0x7ff;
|
||||
|
||||
addend = (upper << 12) | (lower << 1);
|
||||
addend += increment;
|
||||
addend >>= 1;
|
||||
|
||||
upper_insn = (upper_insn & 0xf800) | ((addend >> 11) & 0x7ff);
|
||||
lower_insn = (lower_insn & 0xf800) | (addend & 0x7ff);
|
||||
|
||||
bfd_put_16 (abfd, upper_insn, address);
|
||||
bfd_put_16 (abfd, lower_insn, address + 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
bfd_vma contents;
|
||||
|
||||
contents = bfd_get_32 (abfd, address);
|
||||
|
||||
/* Get the (signed) value from the instruction. */
|
||||
@ -1661,7 +1684,6 @@ arm_add_to_rel (abfd, address, howto, increment)
|
||||
/* Add in the increment, (which is a byte value). */
|
||||
switch (howto->type)
|
||||
{
|
||||
case R_ARM_THM_PC22:
|
||||
default:
|
||||
addend += increment;
|
||||
break;
|
||||
@ -1680,6 +1702,7 @@ arm_add_to_rel (abfd, address, howto, increment)
|
||||
contents = (contents & ~ howto->dst_mask) | (addend & howto->dst_mask);
|
||||
|
||||
bfd_put_32 (abfd, contents, address);
|
||||
}
|
||||
}
|
||||
#endif /* USE_REL */
|
||||
|
||||
|
Reference in New Issue
Block a user