This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Patch for R_ARM_THM_PC22 relocs
- To: Momchil Velikov <velco at fadata dot bg>
- Subject: Re: Patch for R_ARM_THM_PC22 relocs
- From: Alan Modra <alan at linuxcare dot com dot au>
- Date: Fri, 29 Sep 2000 16:14:53 +1100 (EST)
- cc: binutils at sourceware dot cygnus dot com
On 28 Sep 2000, Momchil Velikov wrote:
> --- bfd/elf32-arm.h.orig Thu Sep 28 21:03:13 2000
> +++ bfd/elf32-arm.h Thu Sep 28 21:03:44 2000
> @@ -1642,9 +1642,29 @@
> reloc_howto_type * howto;
> bfd_signed_vma increment;
> {
> - bfd_vma contents;
> bfd_signed_vma addend;
>
> + if (howto->type == R_ARM_THM_PC22)
> + {
> + short upper, lower;
> + upper = bfd_get_16 (abfd, address) & 0x7ff;
> + lower = bfd_get_16 (abfd, address + 2) & 0x7ff;
> + upper = (upper ^ 0x400) - 0x400; /* Sign extend. */
> +
> + addend = (upper << 12) | (lower << 1);
> + addend += increment;
> + addend >>= 1;
> +
> + upper = (upper & 0xf800) | ((addend >> 11) & 0x7ff);
> + lower = (lower & 0xf800) | (addend & 0x7ff);
Seems to me you're trying to extract bits from upper and lower that have
been removed with the "& 0x7ff" above.
> +
> + bfd_put_16 (abfd, upper, address);
> + bfd_put_16 (abfd, lower, address + 2);
> + }
--
Linuxcare. Support for the Revolution.