This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] MIPS/GAS: Correct ISA bit handling in backreferences
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: "Maciej W. Rozycki" <macro at codesourcery dot com>
- Cc: <binutils at sourceware dot org>
- Date: Sat, 22 Sep 2012 09:01:03 +0100
- Subject: Re: [PATCH] MIPS/GAS: Correct ISA bit handling in backreferences
- References: <alpine.DEB.1.10.1209211712400.28358@tp.orcam.me.uk>
"Maciej W. Rozycki" <macro@codesourcery.com> writes:
> 2012-09-21 Maciej W. Rozycki <macro@codesourcery.com>
>
> gas/
> * config/tc-mips.c (md_assemble): Add a call to mips_mark_labels.
OK as far as it goes, but...
> gas/testsuite/
> * gas/mips/branch-swap-2.s: Make sure the ISA bit is clear in
> the label used for calculation.
...not OK. "." ought to evaluate to the same thing as a label
on the current instruction. It happens to do that at the moment
because of the bug you're fixing, but only by both being wrong.
Having the (. - foo) in:
foo:
insn1 (. - foo)
evaluate to anything other than 0 is wrong.
To show there's a bug here:
.ent foo
.set micromips
foo:
nop
.L1:
nop
addiu $4,$4,.L2 - .
addiu $4,$4,. - .L1
addiu $4,$4,. - foo
.L2:
nop
.end foo
gives:
00000000 <foo>:
0: 0c00 nop
2: 0c00 nop
4: 3084 000a addiu a0,a0,10
8: 4c8a addiu a0,a0,5
a: 3084 0009 addiu a0,a0,9
e: 0c00 nop
The forward reference (first ADDIU) is correct, but the other two
are wrong. (The forward reference works thanks to your 2010-12-16 change.)
Richard