This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: MIPS assembler branch relaxations


On Sep 14, 2002, Alexandre Oliva <aoliva@redhat.com> wrote:

> +      val = S_GET_VALUE (fragp->fr_symbol) + fragp->fr_offset;
> +
> +      addr = fragp->fr_address + fragp->fr_fix;
> +
> +      val -= addr;
> +
> +      toofar = val < - (0x8000 << 2) || val >= (0x8000 << 2);

I just realized this test is off by 4.  The base address added to the
branch offset is the address of the instruction in the delay slot, not
that of the branch instruction.  I'm amending the patch as follows:

         addr = fragp->fr_address + fragp->fr_fix + 4;

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]