This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH/MIPS] Fix Branches with a constant offset
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: Andrew Pinski <andrew dot pinski at caviumnetworks dot com>
- Cc: binutils <binutils at sourceware dot org>, David Ung <davidu at mips dot com>, Catherine Moore <clm at codesourcery dot com>
- Date: Wed, 06 Jun 2012 20:23:55 +0100
- Subject: Re: [PATCH/MIPS] Fix Branches with a constant offset
- References: <CA+=Sn1nF7wT3NufD=XdRCQbenSWc7RER2KW3v1OSYh-Yg=bwHQ@mail.gmail.com>
Andrew Pinski <andrew.pinski@caviumnetworks.com> writes:
> Hi,
> After:
> 2011-04-20 Catherine Moore <clm@codesourcery.com>
> David Ung <davidu@mips.com>..
> * config/mips.c (mips_cl_insn): Add new field complete_p
> ...
> (append_insn): Move O_constant expression handling.
>
> branches with a constant expression are broken by adding a relocation to them.
> The relocation is totally wrong as it is saying it is an absolute
> address while what we have really is an offset.
>
> This patch fixes the issue with how complete_p is handled for
> O_constant expression handling just like it was handled before this
> patch.
>
> OK? Tested on mips64-linux-gnu with no regressions.
Oops. It's certainly unfortunate that we've changed the meaning
of this case. TBH though, the new version makes more sense to me.
If you really want a constant offset, ". + X" is (and IMO always was)
the right way to write it. The old behaviour gave oddities where:
.equ x,0x1000
beq $4,$5,x
would treat "x" as an offset while:
beq $4,$5,x
.equ x,0x1000
would treat it as an address. The new behaviour also seems to be
consistent with other targets.
None of which would be a convincing argument to change the behaviour
for its own sake. But now that we've changed it anyway -- in at least
two releases -- I'm not sure we should go back.
Richard