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
Alan Modra wrote:
>
> 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.
Well, I'm an idiot, of course. And, of course, this is not
the patch I've tested. I'll send another one.
Regards,
-velco