This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: d10v: swapping insns requires swapping relocs
- From: Nick Clifton <nickc at cambridge dot redhat dot com>
- To: Alexandre Oliva <aoliva at redhat dot com>
- Cc: binutils at sources dot redhat dot com
- Date: 03 Dec 2001 10:24:28 +0000
- Subject: Re: d10v: swapping insns requires swapping relocs
- References: <oroflltrws.fsf@free.redhat.lsd.ic.unicamp.br>
Hi Alexandre,
> from Alexandre Oliva <aoliva@redhat.com>
>
> * config/tc-d10v.c (write_2_short): Mark L reloc insn when
> L and R are swapped.
Approved, but...
> if (opcode1->unit == IU)
> - insn = FM00 | (insn2 << 15) | insn1;
> + {
> + swapped = 1;
> + insn = FM00 | (insn2 << 15) | insn1;
> + }
It might be better (and less prone to bit rot in the future) if
instead of setting a 'swapped' flag in all of the places where
instruction swapping occurs, you alter the code that tests to see if
swapping has occurred:
> + /* A BFD_RELOC_D10V_10_PCREL_R relocation applied to the
> + instruction in the L container has to be adjusted to
> + BDF_RELOC_D10V_10_PCREL_L. When processing the L
> + container, j == 0, unless we swapped the containers,
> + in which case the L instruction gets j == 1, i.e.,
> + the L container gets j == swapped. */
> + if (fx->fix[i].reloc == BFD_RELOC_D10V_10_PCREL_R
> + && j == swapped)
Becomes:
if (fx->fixpi].reloc == BFD_RELOC_D10V_10_PCREL_R
&& (j == (((insn & (0xFF << 15)) & insn2) == insn2)))
Cheers
Nick